/**
 * 
 */
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 java.util.Scanner;


public class Solution {
	
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		int size = s.nextInt();
		for (int count = 1; count <= size; count++){
			int dancerNum = s.nextInt();
			int surpNum = s.nextInt();
			int score = s.nextInt();
			int[] dancerScore = new int[dancerNum];
			char[] marks = new char[dancerNum];
			for (int i = 0; i < dancerNum; i++){
				dancerScore[i] = s.nextInt();
			}
			
			int highB = score * 3 - 2;
			int lowB = (score - 1) * 3 - 1;
			int output = 0;
			int sup  = surpNum;
			int markIdx = 0;
			if (score < 2)
			{
				for (Integer i : dancerScore){
					if (i >= score)
					{
						marks[markIdx] = '+';
						output++;
					}else{
						marks[markIdx] = '-';
					}
					markIdx++;
				}
				
			}
			else
			{
				for (Integer i : dancerScore){
					if (i >= highB){
						output++;
						marks[markIdx] = '+';
					}else if (i< highB && i >= lowB && sup > 0){
						//if (){
						output++;
						sup--;
						marks[markIdx] = '*';
//						}else{
//							
//							marks[markIdx] = '-';
//						}
					}
					else{
						marks[markIdx] = '-';
					}
					markIdx++;
				}
			}
//			System.out.print("Case #"+count+": " + dancerNum + " " + surpNum + " "+ score + "		");
//			for (Integer i: dancerScore)
//			{
//				System.out.print(i+"	");
//			}
			System.out.println("Case #"+count+": "+output);
//			for (Character mark: marks)
//			{
//				System.out.print(mark+"	");
//			}
//			System.out.println();
		}
		
	}

}
