import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class Dancing {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// read input file
		File file = new File("B-small-attempt4.in");
		//File file = new File("input.txt");
		BufferedReader br = new BufferedReader(new FileReader(file));
		String ln = "";
		int count = Integer.parseInt(br.readLine());

		// write output file
		File out = new File("outB.txt");
		BufferedWriter bw = new BufferedWriter(new FileWriter(out));
		
		int y = 0;
		for (int i=0; i < count; i++){
			ln = br.readLine();
			y = getY(ln);
			bw.write("Case #" + (i+1) + ": " + y);
			bw.newLine();
		}
		bw.close();
	}
	
	private static int getY(String str) {
		String[] data = str.split(" ");
		int n = Integer.parseInt(data[0]);
		int s = Integer.parseInt(data[1]);
		int p = Integer.parseInt(data[2]);
		int[] t = new int[n];
		for (int i=0; i < n; i++){
			t[i] = Integer.parseInt(data[i+3]);
		}
		int y = 0;
		int base = 0;
		for(int j=0; j < t.length; j++){
			base = t[j] / 3;
			if(base >= p) { y++; }
			else if(base == p-1){
				if(t[j] - (base+p) > base-1 && t[j] > 0){
					y++;
				} else if(s>0 && t[j] - (base+p) > base-2 && t[j] > 0){
					s -= 1;
					y++;
				}
			} else if(base == p-2){
				if(s > 0 && t[j] - (base+p) > base-1 && t[j] > 0){
					s -= 1;
					y++;
				}
			}
		}
		
		return y;
	}

}

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Googlers {

	public static void main(String[] args) throws FileNotFoundException {
		new Googlers().doProcessing(new File("D:\\codejam\\B\\small.txt"));
	}

	public void doProcessing(File inputFile) throws FileNotFoundException {
		Scanner scanner = new Scanner(inputFile).useDelimiter("\n");
		if (scanner != null) {
			int totalCases = Integer.parseInt(scanner.next().trim());
			int k = 1 ;
			if (totalCases > 0) {
				while (scanner.hasNext()) {
					String[] rowValues = scanner.next().trim().split(" ");

					int totalGooglers = Integer.parseInt(rowValues[0]);
					// System.out.println("Total Googlers : " + totalGooglers);
					int totalSuprisingCases = Integer.parseInt(rowValues[1]);
					// System.out.println("Total Surprising Cases : " +
					// totalSuprisingCases);

					int averageScore = Integer.parseInt(rowValues[2]);
					// System.out.println("Total Success Cases : " +
					// averageScore);
					// System.out.println("Total Length : " + rowValues.length);

					int[] totalMarks = new int[totalGooglers];
					int j = 0;
					for (int i = 3; i < rowValues.length; i++) {
						totalMarks[j] = Integer.parseInt(rowValues[i].trim());
						// System.out.println("Value Put : " + totalMarks[j]);
						j++;
					}
					int successCase = getSuccessCase(totalGooglers,
							averageScore, totalSuprisingCases, totalMarks);
					System.out.println("Case #" + k++ + ": " + successCase);
				}

			}
		}
		scanner.close();
	}

	public boolean doNormalCase(int totalScore, int averageScore) {
		boolean success = false;
		int X3value = averageScore * 3;
		if (totalScore >= X3value) {
			success = true;
		} else if ((totalScore >= X3value - 1) || (totalScore >= X3value + 1)) {
			success = true;
		} else if ((totalScore >= X3value - 2) || (totalScore >= X3value + 2)) {
			success = true;
		} else {
			success = false;
		}
		return success;
	}

	public boolean doSurprisingCase(int totalScore, int averageScore) {
		boolean success = false;
		int X3value = averageScore * 3;
		// System.out.println("Total Score : " + totalScore);
		// System.out.println("Average Score : " + X3value);
		if (((totalScore >= X3value - 3) || (totalScore >= X3value + 3))
				&& totalScore > averageScore) {
			success = true;
		} else if (((totalScore >= X3value - 4) || (totalScore >= X3value + 4))
				&& totalScore > averageScore) {
			success = true;
		} else {
			success = false;
		}
		return success;
	}

	public int getSuccessCase(int totalCses, int averageScore,
			int surprisingCase, int[] caseValues) {
		int totalSuccess = 0;
		for (int i = 0; i < totalCses; i++) {
			// System.out.println("----------------------Value Put : " +
			// totalCses);
			boolean normalCaseSuccess = doNormalCase(caseValues[i],
					averageScore);
			if (!normalCaseSuccess) {
				if (surprisingCase > 0) {
					boolean surprisingCaseSuccess = doSurprisingCase(
							caseValues[i], averageScore);
					if (surprisingCaseSuccess) {
						// System.out.println("Surprising Success..." +
						// caseValues[i]);
						totalSuccess++;
						surprisingCase--;
					}
				}
			} else {
				totalSuccess++;
			}
		}
		return totalSuccess;
	}

}
