import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;

public class b {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedInputStream(System.in));

        int T = sc.nextInt();

        for (int casenumber = 1; casenumber <= T; ++casenumber) {

            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();

            int[] ts = new int[n];
            for (int i = 0; i < n; ++i)
                ts[i] = sc.nextInt();

            int thresh1 = (p == 1 ? 1 : (3 * p - 4));
            int thresh2 = (3 * p - 2);

            int count1 = 0, count2 = 0;

            for (int i = 0; i < n; ++i) {
                if (ts[i] >= thresh2) {
                    ++count2;
                    continue;
                }
                if (ts[i] >= thresh1) {
                    ++count1;
                }
            }

            if (count1 > s) {
                count1 = s;
            }

            System.out.format("Case #%d: %d%n", casenumber, count1 + count2);
        }
    }
}

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

public class b {

	public static void main(String[] args) {

		Scanner fin = new Scanner(System.in);

		int numCases = fin.nextInt();

		for (int loop=1; loop<=numCases; loop++) {

			int numPeople = fin.nextInt();
			int numSurprise = fin.nextInt();
			int threshold = fin.nextInt();

			int safe = 0;
			int surprise = 0;
			int lost = 0;
			int either = 0;

			for (int i=0; i<numPeople; i++) {

				int next = fin.nextInt();
				if (threshold >= 2) {

					if (next >= 3*threshold - 2)
						safe++;
					else if (next >=  3*threshold - 4)
						surprise++;
					else
						lost++;
				}
				else {
					if (threshold == 0)
						safe++;
					else {
						if (next >= 1)
							safe++;
						else
							lost++;
					}

				}
			}

			System.out.println("Case #"+loop+": "+(safe+Math.min(surprise, numSurprise)));
		}
	}
}