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

public class Main {
	public static void main(String[] args) throws java.io.FileNotFoundException,java.io.IOException{
		java.io.BufferedReader bRead=new java.io.BufferedReader(new java.io.FileReader("F:\\B-large.in"));
		java.io.BufferedWriter bWrite=new java.io.BufferedWriter(new java.io.FileWriter("F:\\B-large.out"));
		StringBuffer output=new StringBuffer();
		int noCases=Integer.parseInt(bRead.readLine());
		for(int i=0;i<noCases;i++){
			String[] curLine=bRead.readLine().split(" ");
			int s=Integer.parseInt(curLine[1]),p=Integer.parseInt(curLine[2]),baseVal=3*p-2,maxGooglers=0;
			for(int j=3;j<curLine.length;j++){
				int cur=Integer.parseInt(curLine[j]);
				if(cur>=baseVal)maxGooglers++;
				else if((s>0)&&(cur>=p)&&(cur>=(3*p-4))){
					maxGooglers++;s--;					
				}
			}
			output.append("Case #"+(i+1)+": "+maxGooglers+"\n");
		}
		bWrite.write(output.toString());
		bWrite.close();bRead.close();
	}
}
