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.File;
import java.io.FileWriter;
import java.util.Scanner;


public class B {
	
	private static final String NAME = "B-small.txt";
	private static final File input = new File("in", NAME);
	private static final File output = new File("out", NAME);
	
	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(input);
		scanner.useDelimiter("[\\s\\n\\r]+");
		
		FileWriter writer = new FileWriter(output);
		int numberOfTests = scanner.nextInt();
		for (int test = 0; test < numberOfTests; test++) {
			int n = scanner.nextInt();
			int s = scanner.nextInt();
			int p = scanner.nextInt();
			int[] totals = new int[n];
			for (int i = 0; i < n; i++) {
				totals[i] = scanner.nextInt();
			}
			String result = calculate(p * 3 - 4, p * 3 - 2, s, totals);
			String line = String.format("Case #%d: %s\n", test + 1, result);
			writer.append(line);
			System.out.print(line);
		}
		writer.close();
	}
	
	private static String calculate(int low, int high, int surprising, int[] totals) {
		int result = 0;
		for (int total : totals) {
			if (total >= high) {
				result++;
			}
			else if (total >= low && total > 1) {
				if (surprising > 0) {
					surprising--;
					result++;
				}
			}
		}
		return Integer.toString(result);
	}
}
