/**
 * 
 */
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 Scoring {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numLines = sc.nextInt();
		int lineCount = 1;
		
		while (numLines > 0) {
			int numGoogler = sc.nextInt();
			int numSurprisingScores = sc.nextInt();
			int scoreThreshold = sc.nextInt();
			int result = 0;
//			System.out.println(numGoogler +" "+ numSurprisingScores +" "+ scoreThreshold);
			while (numGoogler > 0) {
				int totalScore = sc.nextInt();
//				System.out.println(totalScore);
				boolean passed = processScore(scoreThreshold, totalScore);
				
				if (passed) {
					result++;
//					System.out.println("here!!!");
				} else if (!passed && numSurprisingScores > 0) {
					int maxPossibleScore = calculateMaxScore(totalScore);
					if (maxPossibleScore >= scoreThreshold) {
						result++;
						numSurprisingScores--;
//						System.out.println("here!");
					}
//					System.out.println("here!!");
				}
				numGoogler--;
			}
			System.out.println("Case #" + lineCount + ": " + result);
			lineCount++;
			numLines--;
		}
	}
	
	private static int calculateMaxScore(int totalScore) {
		int avg = totalScore/3;
		int mod = totalScore%3;
		int max = 0;
		if (totalScore != 0) {
			if (mod <= 1) {
				max = avg+1;
			} else if (mod == 2) {
				max = avg+2;
			}
		}
		return max;
	}

	public static boolean processScore(int scoreThreshold, int totalScore) {
		int avg = totalScore/3;
		int mod = totalScore%3;
//		System.out.println(avg+" "+mod);
		
		if (mod > 0) {
			if (avg+1 >= scoreThreshold) {
				return true;
			}
		} else if (mod == 0) {
			if (avg >= scoreThreshold) {
				return true;
			}
		}
		return false;
	}

}
