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);
        }
    }
}

package dancing;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws IOException {
		File file = new File("B-small-attempt0.in");
		FileReader fr = new FileReader(file);
		BufferedReader in = new BufferedReader(fr);

		String line = in.readLine();
		String[] tokens;
		int num = Integer.parseInt(line);
		int i = 1, N, s, p, t, minAlways, minSurprising, always, surprising, finalCount;
		while (i <= num) {
			line = in.readLine();
			tokens = line.split(" ");
			N = Integer.parseInt(tokens[0]);
			s = Integer.parseInt(tokens[1]);
			p = Integer.parseInt(tokens[2]);
			if (p >= 2) {
				minAlways = 3 * p - 2;
				minSurprising = 3 * p - 4;
			} else {
				minAlways = p;
				minSurprising = 1;
			}

			always = 0;
			surprising = 0;

			for (int j = 0; j < N; j++) {
				t = Integer.parseInt(tokens[3 + j]);
				if (t >= minAlways) {
					always++;
				} else if (t >= minSurprising) {
					surprising++;
				}
			}

			finalCount = always + Math.min(s, surprising);

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

}
