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

public class ProblemB {

    public static int count(int s, int p, int[] notes) {
	int count = 0;
	for (int note : notes) {
	    if (note + 2 >= 3 * p) {
		count++;
	    } else if (note + 4 >= 3 * p && s > 0 && note >= p) {
		count++;
		s--;
	    }
	}
	return count;
    }

    public static void main(String[] args) throws IOException {
	String filename = args[0];
	BufferedReader br = new BufferedReader(new FileReader(filename));

	int T = Integer.parseInt(br.readLine());
	for (int i = 1; i <= T; ++i) {
	    String[] line = br.readLine().split(" ");

	    int N = Integer.parseInt(line[0]);
	    int s = Integer.parseInt(line[1]);
	    int p = Integer.parseInt(line[2]);
	    int[] notes = new int[N];

	    for (int j = 0; j < N; ++j) {
		notes[j] = Integer.parseInt(line[3+j]);
	    }

	    System.out.println("Case #" + i + ": " + count(s, p, notes));
	}

	br.close();
    }

}