package codejam;

import fixjava.Pair;

public class Utils {

	public static long minLong(long firstVal, long... otherVals) {
		long minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static int minInt(int firstVal, int... otherVals) {
		int minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static float minFloat(float firstVal, float... otherVals) {
		float minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	/**
	 * ArgMin returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMin(int[] arr) {
		int min = arr[0];
		int argMin = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] < min) {
				min = arr[i];
				argMin = i;
			}
		}
		return new Pair<Integer, Integer>(argMin, min);
	}

	/**
	 * ArgMax returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMax(int[] arr) {
		int max = arr[0];
		int argMax = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] > max) {
				max = arr[i];
				argMax = i;
			}
		}
		return new Pair<Integer, Integer>(argMax, max);
	}

}

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class G_2 {

    static int n, s, p;
    static int[] tt;

    public static void main(String[] args) throws IOException {
        PrintWriter bw = new PrintWriter(new FileWriter("1.txt"));
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        scan.nextLine();
        for (int i = 0; i < t; i++) {
            n = scan.nextInt();
            s = scan.nextInt();
            p = scan.nextInt();
            tt = new int[n];
            int a = 3 * p - 4;
            if (p == 1) {
                a = 1;
            }
            if (p == 0) {
                a = 0;
            }
            // int b = 3 * p + 4;
            int c = 3 * p - 2;
            // int d = 3 * p + 2;
            int count = 0;

            for (int j = 0; j < n; ++j) {
                tt[j] = scan.nextInt();
                if (c <= tt[j]) {
                    count++;
                    continue;
                }
                if (a <= tt[j] && s != 0) {
                    s--;
                    count++;
                    continue;
                }
            }

            System.out.println(String.format("Case #%d: %d", (i + 1), count));
            bw.write(String.format("Case #%d: %d\n", (i + 1), count));
        }
        bw.flush();
        bw.close();
    }
}
