import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;


public class B {
	static int[][] memo;
	static int[] nums;
	static int p;
	public static void main(String[] args)throws IOException
	{
		Scanner br=new Scanner(new File("B-small-attempt0.in"));
		PrintWriter out=new PrintWriter(new File("b.out"));
		int cases=br.nextInt();
		for(int c=1;c<=cases;c++)
		{
			int n=br.nextInt(),s=br.nextInt();
			p=br.nextInt();
			nums=new int[n];
			for(int i=0;i<n;i++)
				nums[i]=br.nextInt();
			memo=new int[n][s+1];
			for(int[] a:memo)
				Arrays.fill(a,-1);
			out.printf("Case #%d: %d\n",c,go(0,s));
		}
		out.close();
	}
	public static int go(int index,int s)
	{
		if(index>=nums.length)
			return 0;
		if(memo[index][s]!=-1)
			return memo[index][s];
		int best=0;
		for(int i=0;i<=10;i++)
		{
			int max=i;
			for(int j=0;j<=10;j++)
			{	
				if(Math.abs(i-j)>2)
					continue;
				max=Math.max(i,j);
				thisone:
				for(int k=0;k<=10;k++)
				{
					int ret=0;
					if(Math.abs(i-k)>2||Math.abs(j-k)>2)
						continue;
					max=Math.max(max,k);
					int count=0;
					if(Math.abs(i-k)==2)
						count++;
					if(Math.abs(i-j)==2)
						count++;
					if(Math.abs(j-k)==2)
						count++;
					if(i+j+k==nums[index])
					{
						boolean surp=(count>=1);
						if(surp&&s>0)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s-1);
						}
						else if(!surp)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s);
						}
						best=Math.max(best,ret);
					}
					else if(i+j+k>nums[index])
						break thisone;
				}
			}
		}
		return memo[index][s]=best;
	}
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Saransh
 */
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;


public class Main {

    static int pts[];
    static int n,s,p;
    static int memo[][];
    static boolean marked[][];
    public static void main(String[] args)
    {
        try
        {
            Scanner sc=new Scanner(System.in);
            int t=sc.nextInt();
			int test=1;
            while(t-->0)
            {
                n=sc.nextInt();
                s=sc.nextInt();
                p=sc.nextInt();
                pts=new int[n];
                memo=new int[n+1][s+1];
                marked=new boolean[n+1][s+1];
                for(int i=0;i<n;i++)pts[i]=sc.nextInt();
                System.out.println("Case #"+test+": "+find(0,s));
				test++;
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    public static int find(int pos,int sur)
    {
        if(pos==n)
        {
            if(sur==0)return 0;
            return -10000;
        }
        if(marked[pos][sur])return memo[pos][sur];
        marked[pos][sur]=true;
        int max=-10000;
        for(int p1=0;p1<=10;p1++)
        {
            for(int p2=0;p2<=10;p2++)
            {
                int p3=pts[pos]-p1-p2;
                if(p3>=0&&p3<=10)
                {
                    int arr[]=new int[3];
                    arr[0]=p1;
                    arr[1]=p2;
                    arr[2]=p3;
                    Arrays.sort(arr);
                    if(arr[2]-arr[0]==2&&sur>0)
                    {
                        if(arr[2]>=p)
                        {
                            max=Math.max(max,1+find(pos+1,sur-1));
                        }
                        else
                        {
                            max=Math.max(max,find(pos+1,sur-1));
                        }
                    }
                    else if(arr[2]-arr[0]<2)
                    {
                        if(arr[2]>=p)
                        {
                            max=Math.max(max,1+find(pos+1,sur));
                        }
                        else
                        {
                            max=Math.max(max,find(pos+1,sur));
                        }
                    }
                }
            }
        }
        memo[pos][sur]=max;
        return max;

    }

}


