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.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class B {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("B-large.in"));
		String li;
		int tcn = Integer.parseInt(in.readLine());
		Scanner sc;
		int N, S, P;
		int[] scr;
		for (int tc = 0; tc < tcn; tc++) {
			li = in.readLine();
			sc = new Scanner(li);
			N = sc.nextInt(); S = sc.nextInt(); P = sc.nextInt();
			scr = new int[N];
			for (int i = 0; i < N; i++) {
				scr[i] = sc.nextInt();
			}
			
			Arrays.sort(scr);
			
			int result = 0;
			for (int i = scr.length - 1; i >=0; i--) {
				int tmp = scr[i] / 3;
				if (P - tmp >= 3 || (scr[i] == 0 && P > 0)) break;
				int r = scr[i] % 3;
				if (tmp >= P) {
					result++;
				} else {
					if (P - tmp == 1) {
						if (r > 0) {
							result++;
						} else {
							if (S > 0) {
								result++;
								S--;
							}
						}
					} else {
						if (P -tmp == 2) {
							if (r == 2 && S > 0) {
								result++;
								S--;
							}
						}
					}
				}
			}
			
			System.out.println("Case #" + (tc + 1) + ": " + result);
		}
		in.close();
	}

}
