import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class DancingWithTheGooglers {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader (new FileReader("B-small.in"));
		PrintWriter out = new PrintWriter(new FileWriter("B-small.out"));
		
		int t = Integer.parseInt(f.readLine());
		for (int i = 0; i < t; i++){
			int c = 0;
			StringTokenizer st = new StringTokenizer(f.readLine());
			int n = Integer.parseInt(st.nextToken());
			int[] ti = new int[n];
			int s = Integer.parseInt(st.nextToken());
			int p = Integer.parseInt(st.nextToken());
			for (int j = 0; j < n; j ++){
				ti[j] = Integer.parseInt(st.nextToken());
				if (ti[j] % 3 == 0){
					if (ti[j] / 3 >= p)
						c++;
					else if (ti[j] / 3 == (p-1) && s > 0 && ti[j] >= 2){
						s--;
						c++;
					}
				}
				else if (ti[j] % 3 == 1){
					if ((ti[j] / 3) + 1 >= p)
						c++;					
				}
				else{
					if (ti[j] / 3 >= p-1)
						c++;
					else if (ti[j] / 3 == (p-2) && s > 0){
						s--;
						c++;
					}
				}
					
				
			}
			out.println("Case #" + (i+1) + ": " + c);
			
			
		}
		out.close();
		System.exit(0);
		
		
		
	}
}

import java.io.*;
import java.util.Scanner;


public class DancingGoogler {

	static String outputFile, inputFile;
	public static void main(String[] args) throws IOException  {
		if (args.length != 2)
			return;
		inputFile = args[0];
		outputFile = args[1];

		// Create FileReader Object
		FileReader inputFileReader = new FileReader(inputFile);
		FileWriter outputFileReader = new FileWriter(outputFile);

		// Create Buffered/PrintWriter Objects
		BufferedReader inputStream = new BufferedReader(inputFileReader);
		PrintWriter outputStream = new PrintWriter(outputFileReader);
		
		Scanner scanner;
		String inLine = null;
		int cases = Integer.parseInt(inputStream.readLine().trim());
		
		int num, surprising, score;
		int[] scores;
		for (int i = 1; i < cases + 1; i++) {
			inLine = inputStream.readLine().trim();
			scanner = new Scanner(inLine);
			num = scanner.nextInt();
			surprising = scanner.nextInt();
			score = scanner.nextInt();
			scores = new int[num];
			for (int j=0; j<num; j++){
				scores[j] = scanner.nextInt();
			}
			outputStream.println("Case #"+i+": "+getBestDancers(scores, surprising, score));
		}
		
		outputStream.close();

	}
	
	private static int getBestDancers(int[] scores, int surprising, int targetSc ){
		int totalTarget = 3*targetSc;
		int numBest = 0;
		if (totalTarget==0) return scores.length;
		
		for (int i=0; i<scores.length; i++){
			if (scores[i]>= totalTarget-2) numBest++;
			else if (totalTarget > 3 && scores[i] >= totalTarget-4 ) {
				if (surprising>0){
					numBest++;
					surprising--;
				}
			}
		}
		return numBest;
	}

}
