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 final String INPATH = "input2.in";
	public static final String OUTPATH = "output2.out";

	public static void main (String[] args) throws FileNotFoundException {
		Scanner inscan = new Scanner (new File (INPATH));
 		PrintStream out = new PrintStream (new File (OUTPATH));
		
		int T = inscan.nextInt();
		inscan.nextLine();
		
		for (int i=1; i <= T; i++) {
			int result = compute (inscan.nextLine());
			out.println("Case #" + i + ": " + result);
		}
	}
	
	public static int compute (String line) {
		Scanner linescan = new Scanner (line);
		int N = linescan.nextInt();
		int S = linescan.nextInt();
		int p = linescan.nextInt();
		
		if (p == 0) {
			return N;
		}
		
		int count = 0;
		for (int i=0; i < N; i++) {
			int t = linescan.nextInt();
			
			if (t >= 3*p - 2) {
				count++;
			} else if (3*p - 4 <= t && t <= 3*p - 3 && S > 0 && !(p == 1 && t == 0)) {
				count++;
				S--;
			}
		}
		
		return count;
	}

}