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;
	}
}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;

public class p2 {

    public static void main(String args[]) throws Exception {
        String inputPath = "D:\\B-small-attempt0.in";
        String outputPath = "D:\\abc.out";

         p2 dwg = new p2();
        String[] str = dwg.readFromFile(inputPath);
        str = dwg.solution(str);
        dwg.writeToFile(outputPath, str);
    }

    private String[] solution(String[] str){
        String[] strNew = new String[str.length-1];
        for(int i=0; i<strNew.length; i++){
            strNew[i] = "Case #" +(i+1)+ ": " + find(str[i + 1]);
         }
        return strNew;
    }

    public int find(String str){
        String s1[] = str.split(" ");
        int n = Integer.parseInt(s1[0]);
         int s = Integer.parseInt(s1[1]);
        int p = Integer.parseInt(s1[2]);
        int y=0;
        int[] t = new int[n];
        for(int i=0; i<n; i++){
            t[i] = Integer.parseInt(s1[i+3]);
        }
        Arrays.sort(t);
        for(int x : t){
            int max1=0;
            int max2=0;
            if(x < 2){
                max1=max2=x;
            }
            else if(x==2){
                max1=1;
                if(s > 0){
                    max2=2;
                }
                if(max2 >= p){
                    s--;
                }
            }
            else if(x%3 == 0){
                max1 = x/3;
                if(s > 0 && max1<p){
                    max2 = x/3 + 1;
                    if(max2 >= p){
                        s--;
                    }

                }
            }
            else if(x%3 == 1){
                max1 = x/3 + 1;
            }
            else{
                max1 = x/3 + 1;
                if(s > 0 && (x/3 + 2) <= 10 && max1<p){
                    max2 = x/3 + 2;
                    if(max2 >= p){
                        s--;
                    }
                }
            }
             if(max1>=p || max2>=p){
                y++;
            }
        }

        return y;
    }



    public String[] readFromFile(String inputPath) throws FileNotFoundException,IOException {
        FileInputStream fis = null;
        DataInputStream dis = null;
        BufferedReader br = null;
        ArrayList<String> strArrList = new ArrayList<String>();
        try{
            fis = new FileInputStream(inputPath);
            dis = new DataInputStream(fis);
            br = new BufferedReader(new InputStreamReader(dis));
            String strLine;
            while ((strLine = br.readLine()) != null)   {
                strArrList.add(strLine);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally{
            try{
                if (br != null) {
                    br.close();
                }
                if (dis != null) {
                     dis.close();
                }
                if (fis != null) {
                    fis.close();
                }
            } catch(IOException e) {
                e.printStackTrace();
            }
        }
        return strArrList.toArray(new String[strArrList.size()]);
    }

    public void writeToFile(String outputPath, String[] strArr) {
        BufferedWriter bw = null;
        try {
            bw = new BufferedWriter(new FileWriter(outputPath));

            for(int i=0; i<strArr.length; i++){
                 bw.write(strArr[i]);
                bw.newLine();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bw != null) {
                    bw.flush();
                    bw.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}