/**
 * 
 */
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();

	}

}

import static java.util.Arrays.deepToString;

import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class QB {

	public static void main(String[] args) throws Exception 
	{
		new QB().run();
		
	}

	void run() throws Exception 
	{
		//Scanner sc = new Scanner(System.in);
		//PrintWriter pw = new PrintWriter(System.out);
		
		Scanner sc = new Scanner(new FileReader("B-small-attempt1.in"));
		
		FileWriter fstream = new FileWriter("out.in");
		BufferedWriter out = new BufferedWriter(fstream);
		
		
		//PrintWriter pw = new PrintWriter(new FileWriter("Asmall.out"));
		
		int ntest = Integer.valueOf(sc.nextLine());
		
		for(int test=1;test<=ntest;++test) 
		{
			int playerNum = sc.nextInt();
			int surpNum = sc.nextInt();
			int min = sc.nextInt();
			//debug(playerNum);
			int score = 0;
			int criteria = min*3 - 4;
			
			for(int i=0; i<playerNum; i++)
			{
				int current = sc.nextInt();
				if(current >= min)
				{
					if(current >= criteria + 2)
					{
						score ++;
					} else if(current >= criteria)
					{
						if(surpNum > 0)
						{
							surpNum --;
							score++;
						}
					}
				}
				
			}
			
			//debug(score);
			out.write("Case #" + test + ": ");
			out.write(score + "");
			out.write("\n");
		}
		out.close();
		sc.close();
	
	}
	
	void debug(Object...os) 
	{
		System.err.println(deepToString(os));
	} 
	
	void debugArray(Object[]...os) 
	{
		System.err.println(deepToString(os));
	} 
}
