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 codejam;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public abstract class Task {
	
	private String inputFileName;
	private BufferedReader in;
	private PrintWriter out;

	public Task(String[] args) {
		inputFileName = args[0];
	}
	
	public void execute() throws IOException {
		File f = new File(inputFileName);   
        in = new BufferedReader(new FileReader(f));
        
		catchInputData();
		
		in.close();
		
		processInputData();
		
		f = new File(inputFileName.substring(0, inputFileName.length() - 2) + "out");
		f.createNewFile();
		out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
		
		generateOutputFile();
		
		out.flush();
		out.close();
	}

	protected abstract void generateOutputFile() throws IOException;

	protected abstract void processInputData();

	protected abstract void catchInputData() throws IOException;

	protected String readLine() throws IOException {
		return in.readLine();
	}

	protected void writeLine(String line) throws IOException {
		out.println(line);
	}

}
