import java.util.Scanner;
public class B {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		for(int zz = 1; zz <= T;zz++){
			int N = in.nextInt();
			int S = in.nextInt();
			int p = in.nextInt();
			int x = 0;
			for(int i = 0; i < N;i++){
				int score = in.nextInt();
				int best = score/3;
				int mod = score%3;
				int diff = p-best;
				if(diff<1){
					x++;
				}else if(diff<2){
					if(mod==0 && score !=0){
						if(S!=0){
							S--;x++;
						}
					}else if(score!=0){
						x++;
					}
				}else if(diff<3){
					if(mod==2){
						if(S!=0){
							S--;x++;
						}
					}
				}
			}
			System.out.format("Case #%d: %d\n", zz, x);
		}
	}
}

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

import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Set;

/**
 *
 * @author daniele
 */
public class GCJ_B {
    
    
    public static void main(String[] args) throws Exception{
        
        
        Scanner in = new Scanner(new File(args[0]));
        FileWriter out = new FileWriter("/home/daniele/Scrivania/Output");
        
        int n,p,s;
        int countp=0,counts=0;
        int prove=in.nextInt();
        ArrayList<Integer> tp;
        
        
        
        out.write("");
        out.flush();
        
        for(int i=1;i<=prove;i++){
            out.append("Case #" +i+": ");out.flush();
            n=in.nextInt();
            s=in.nextInt();
            p=in.nextInt();
            tp= new ArrayList<Integer>();
            for(int j=0;j<n;j++)
                tp.add(in.nextInt());
            
            for(int j=0;j<tp.size();j++){
                int f=tp.get(j)-p;
                if( f>=0 && f/2>=p-2){
                    countp++;
                    if( f/2==p-2 && s==0 )
                      countp--;
                    else if(f/2==p-2 && s>0)
                        s--; 
                }
                
            }
            System.out.println("countp="+countp+" counts="+counts+" s="+s);

            out.append(countp+"\n");out.flush();
            countp=0; counts=0;
            System.out.println("**************");


        }
     
        
        
    }
    
    
    
}
