package dancinggooglers;

import java.io.File;
import java.util.Scanner;

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

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

public class DanceGooglers {
	static String name = "B-large";

	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader(name + ".in"));
		PrintWriter out = new PrintWriter(name + ".out");
		int t = Integer.parseInt(in.readLine()), caseN = 1;
		while (caseN <= t) {
			int ans = 0;
			StringTokenizer tok = new StringTokenizer(in.readLine());
			int n = Integer.parseInt(tok.nextToken()), s = Integer.parseInt(tok
					.nextToken()), p = Integer.parseInt(tok.nextToken());

//			System.out.println(n + " " + s + " " + p);
			for (int i = 0; i < n; i++) {
				int total = Integer.parseInt(tok.nextToken());
//				System.out.println(total);
				if (total < p)
					continue;
				
				if (total >= p * 3 - 2) {
					ans++;
					continue;
				}

				if (total >= p * 3 - 4 && s > 0) {
					s--;
					ans++;
				}
			}
			out.print("Case #");
			out.print(caseN++);
			out.print(": ");
			out.println(ans);
//			System.out.println(caseN - 1 + " ans " + ans);
		}
		out.flush();
	}
}