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

public class P02 {

	public static void main(String[] args) {
		init();
		Scanner inp = new Scanner(System.in);
		int t = inp.nextInt();
		inp.nextLine();
		int i = 1;
		while (t > 0) {
			int n = inp.nextInt();
			int s = inp.nextInt();
			int p = inp.nextInt();
			int ret = 0;
			for (int j = 0; j < n; j++) {
				int x = inp.nextInt();
				int v = x / 3;
				int mo = x % 3;
				if (v >= p)
					ret++;
				else if (mo > 0 && (v + 1) >= p)
					ret++;
				else if (s > 0 && (v + 2) >= p && mo == 2) {
					s--;
					ret++;
				} else if (s > 0 && (v + 1) >= p && (mo == 1 || v > 0)) {
					s--;
					ret++;
				}
			}

			System.out.println("Case #" + i + ": " + ret);

			--t;
			++i;
		}

	}

	static String[] coded = { "ejp mysljylc kd kxveddknmc re jsicpdrysi",
			"rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd",
			"de kr kd eoya kw aej tysr re ujdr lkgc jvqz" };
	static String[] uncoded = { "our language is impossible to understand",
			"there are twenty six factorial possibilities",
			"so it is okay if you want to just give upzq" };

	static Map<Character, Character> mapping = new HashMap<Character, Character>();

	private static void init() {
		for (int i = 0; i < coded.length; i++) {
			for (int j = 0; j < coded[i].length(); j++) {
				mapping.put(coded[i].charAt(j), uncoded[i].charAt(j));
			}
		}
	}

	private static String translate(String line) {
		String ret = "";
		for (int i = 0; i < line.length(); i++) {
			if (mapping.containsKey(line.charAt(i))) {
				ret = ret + mapping.get(line.charAt(i));
			} else if (line.charAt(i) == ' ') {
				ret = ret + line.charAt(i);
			} else {
				System.out.println("NOT " + line.charAt(i));
			}
		}
		return ret;

	}
}
