/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

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

import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author youssefgamil
 */
public class Gcj12_qB {

    /**
     * @param args the command line arguments
     */
    public static int scores[]=new int[40];//10+10+10=30
    
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        FileOutputStream out=new FileOutputStream("out.txt");
        int tc,i,j,k,T=sc.nextInt();
        
        int N,S,p,res;
        
        for(tc=1;tc<=T;tc++)
        {
            N=sc.nextInt();
            S=sc.nextInt();
            p=sc.nextInt();
            Arrays.fill(scores,0);
            res=0;
            
            for(i=0;i<N;i++)
                scores[sc.nextInt()]++;
            
            for(int h=0;h<N;h++)
            for(i=0;i<11;i++)
                for(j=i;j<11;j++)
                    for(k=j;k<11;k++)
                        if(scores[i+j+k]>0)
                        {
                            if(Math.abs(k-j)>2 || Math.abs(k-i)>2 || Math.abs(i-j)>2)
                                continue;
                            
                            
                            
                            if(Math.max(i,Math.max(j,k))>=p)
                            {
                                if(Math.abs(i-j)==2 || Math.abs(k-j)==2 || Math.abs(k-i)==2)
                                {
                                        if(S>0)
                                        {
                                            S--;
                                            res++;
                                            scores[i+j+k]--;
                                        }
                                }
                                else
                                {
//                                    res++;
//                                    scores[i+j+k]--;
                                }
                            }
                          //  System.out.println("Posible sol="+i+","+j+","+k+"\t\tS="+S);
                        }
            
            for(int h=0;h<N;h++)
            for(i=0;i<11;i++)
                for(j=i;j<11;j++)
                    for(k=j;k<11;k++)
                        if(scores[i+j+k]>0)
                        {
                            if(Math.abs(k-j)>2 || Math.abs(k-i)>2 || Math.abs(i-j)>2)
                                continue;
                            
                            
                            
                            if(Math.max(i,Math.max(j,k))>=p)
                            {
                                if(Math.abs(i-j)==2 || Math.abs(k-j)==2 || Math.abs(k-i)==2)
                                {
                                        if(S>0)
                                        {
//                                            S--;
//                                            res++;
//                                            scores[i+j+k]--;
                                        }
                                }
                                else
                                {
                                    res++;
                                    scores[i+j+k]--;
                                }
                            }
                          //  System.out.println("Posible sol="+i+","+j+","+k+"\t\tS="+S);
                        }
            
            
            res=Math.min(res,N);
            System.out.print(("Case #"+tc+": "+res+"\n"));
            out.write(("Case #"+tc+": "+res+"\n").getBytes());
        }
        out.close();
        // TODO code application logic here
    }
}
