import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

public class CodeJam {

//	public static final String INPUT_FILE_PATH = "D://CodeJamInput.txt";
	public static final String INPUT_FILE_PATH = "D://B-large.in";
	public static final String OUTPUT_FILE_PATH = "D://CodeJamOutput.txt";

	public static List<String> readInput() {
		List<String> list = new ArrayList<String>();
		try {
			BufferedReader input = new BufferedReader(new FileReader(
					INPUT_FILE_PATH));
			try {
				String line = null;

				while ((line = input.readLine()) != null) {
					list.add(line);
				}
			} finally {
				input.close();
			}
		} catch (IOException ex) {
			ex.printStackTrace();
		}
		
		return list;
	}

	public static void writeOutput(List<String> output) {
		PrintWriter writer = null;
		try {
			writer = new PrintWriter(new FileWriter(OUTPUT_FILE_PATH));
			for (String line : output) {
				writer.println(line);
			}
			writer.flush();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (writer != null)
				writer.close();
		}
	}
	
	public static void main(String[] args) {
		List<DanceFloor> danceFloors = DanceFloor.parseFromFile(CodeJam.readInput());
		List<String> output = new ArrayList<String>();

		for(int i = 0; i < danceFloors.size(); i++) {
			System.out.println(danceFloors.get(i));
			String line = "";
			line += "Case #" + (i + 1) + ": " + danceFloors.get(i).calculate();
			output.add(line);
		}
		
		CodeJam.writeOutput(output);
	}
}

class DanceFloor {

	private List<Integer> tripletsTotalCounts;
	private int surpriseCount;
	private int targetScore;
	private int dancersCount;

	public DanceFloor(List<Integer> tripletsTotalCounts, int surpriseCount,
			int targetScore, int dancersCount) {
		this.tripletsTotalCounts = tripletsTotalCounts;
		this.surpriseCount = surpriseCount;
		this.targetScore = targetScore;
		this.dancersCount = dancersCount;
	}

	public int calculate() {
		int result = 0;
		
		if (targetScore == 0) return dancersCount;
		
		for (int i = 0; i < tripletsTotalCounts.size(); i++) {
			int total = tripletsTotalCounts.get(i);

			if (total < (targetScore * 3 - 4)) {
				tripletsTotalCounts.remove(i--);
			} else if (total == 0) {
				tripletsTotalCounts.remove(i--);
			}
		}
		
		for (int i = 0; i < tripletsTotalCounts.size(); i++) {
			int total = tripletsTotalCounts.get(i);

			if ((surpriseCount > 0) && (total == targetScore * 3 - 4)) {
				result++;
				surpriseCount--;
				tripletsTotalCounts.remove(i--);
			} else if ((surpriseCount == 0) && (total == targetScore * 3 - 4)) {
				tripletsTotalCounts.remove(i--);
			}
		}
		
		for (int i = 0; i < tripletsTotalCounts.size(); i++) {
			int total = tripletsTotalCounts.get(i);

			if ((surpriseCount > 0) && (total == targetScore * 3 - 3)) {
				result++;
				surpriseCount--;
				tripletsTotalCounts.remove(i--);
			} else if ((surpriseCount == 0) && (total == targetScore * 3 - 3)) {
				tripletsTotalCounts.remove(i--);
			}
		}
		
		result += tripletsTotalCounts.size();
		
		return result;
	}

	public static List<DanceFloor> parseFromFile(List<String> readInput) {
		List<DanceFloor> result = new ArrayList<DanceFloor>();
		int testCaseCount = Integer.parseInt(readInput.get(0));

		for (int i = 0; i < testCaseCount; i++) {
			String line[] = readInput.get(i + 1).split(" ");

			List<Integer> totalCounts = new ArrayList<Integer>();
			for (int j = 0; j < Integer.parseInt(line[0]); j++) {
				totalCounts.add(Integer.parseInt(line[3 + j]));
			}

			result.add(new DanceFloor(totalCounts, Integer.parseInt(line[1]),
					Integer.parseInt(line[2]), Integer.parseInt(line[0])));
		}

		return result;
	}

	@Override
	public String toString() {
		return "dancersCount = " + dancersCount + "; surpriseCount = " + surpriseCount 
								 + "; targetScore = " + targetScore + "; tripletsTotalCounts" 
								 + tripletsTotalCounts.toString();
	}
}



public class DancingGooglers {
	static String test = "4\n3 1 5 15 13 11\n3 0 8 23 22 21\n2 1 1 8 0\n6 2 8 29 20 8 18 18 21";
	static String val = "100\n6 2 8 29 20 8 18 18 21\n68 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n54 30 6 1 12 14 26 21 28 3 12 16 11 7 10 11 13 8 3 15 19 1 26 0 20 11 8 6 29 10 14 23 27 2 16 2 0 0 23 2 27 18 17 4 25 20 5 5 25 16 7 27 23 0 4 27 4\n73 30 2 18 3 2 10 3 2 3 3 15 21 3 2 2 3 27 2 2 3 6 1 16 21 2 8 17 3 8 29 14 2 2 20 13 2 30 21 3 2 2 2 14 28 2 30 3 18 21 1 2 2 14 20 7 3 2 17 2 14 2 25 2 2 21 3 21 3 3 3 0 2 2 23 3\n52 15 5 21 29 12 13 12 11 11 12 25 28 0 12 30 23 11 27 12 11 11 16 12 12 11 4 17 11 11 19 12 12 19 0 20 24 12 4 24 11 5 5 12 6 12 11 12 1 12 11 24 12 11 7\n95 45 4 1 11 18 8 10 26 24 12 14 7 21 9 18 11 3 21 3 0 4 1 4 10 24 3 9 1 9 3 9 13 24 13 11 26 29 14 16 12 22 12 14 18 15 8 18 9 16 14 24 17 19 17 25 4 5 23 19 11 29 17 12 3 20 15 8 21 26 27 3 22 6 29 15 10 14 5 28 27 6 12 3 8 5 13 23 10 15 1 12 8 4 18 22 5 11\n65 25 10 30 25 19 27 18 26 22 19 6 27 28 27 26 25 27 3 21 19 9 15 26 27 18 27 26 28 22 26 24 17 1 27 26 25 27 26 0 27 23 20 26 21 11 10 26 26 26 26 23 11 27 29 27 26 26 27 27 11 26 25 27 26 17 27 6\n17 17 3 27 6 25 13 13 3 8 8 4 2 11 16 5 20 11 12 13\n76 76 1 13 9 23 28 7 7 24 20 17 10 3 9 16 11 20 20 17 20 24 19 20 11 10 16 16 5 28 17 17 6 12 26 22 26 11 4 12 5 4 28 4 11 17 22 10 23 4 27 28 18 18 22 11 4 2 14 6 12 7 26 15 19 11 12 12 11 14 28 15 26 7 25 20 23 11 19\n44 11 10 21 19 4 10 11 7 30 25 11 29 26 15 11 3 15 19 11 5 14 21 25 9 22 1 16 10 13 16 10 13 8 7 18 0 9 17 2 1 4 17 14 23 22 26\n67 30 4 18 8 8 18 25 7 9 8 8 30 9 8 26 8 18 9 8 22 8 5 8 9 8 5 11 8 9 26 16 9 8 9 23 9 5 8 19 8 17 2 10 9 8 9 4 8 0 9 1 8 26 2 8 9 9 21 9 8 11 8 9 17 9 9 17 9 0\n21 21 2 16 27 20 25 8 10 22 16 18 7 25 9 5 23 15 23 24 20 13 12 4\n5 2 9 19 24 6 24 23\n15 7 0 29 0 10 12 25 25 27 0 9 20 0 7 15 25 16\n57 16 9 23 24 9 23 13 30 23 24 23 23 24 23 7 6 24 24 27 19 24 24 23 19 24 23 24 1 24 23 24 29 12 24 23 2 0 19 23 10 23 24 1 16 6 22 24 23 3 23 24 16 10 24 24 24 23 24 24\n89 78 6 22 27 9 15 28 13 26 28 21 4 11 3 10 25 16 16 15 2 18 2 22 19 21 16 24 7 3 5 12 4 12 12 17 20 21 30 4 17 22 3 13 18 10 10 4 1 29 7 24 2 11 25 13 29 28 16 24 12 5 8 6 20 10 24 13 18 30 12 21 4 20 0 13 2 6 11 25 10 13 23 22 27 17 16 9 30 28 9 7\n19 3 5 11 11 12 11 25 12 12 8 11 12 12 12 12 17 11 12 11 5 1\n90 22 3 8 7 19 6 5 5 6 5 5 1 5 26 5 16 20 6 17 4 5 5 28 24 15 26 6 5 1 6 5 30 9 1 20 20 5 5 5 6 5 5 5 6 5 6 10 5 6 22 22 5 5 5 27 6 18 0 5 6 6 9 5 6 0 10 6 6 6 6 12 6 5 17 3 19 13 0 5 6 6 5 16 6 24 5 9 6 5 5 6 12\n48 48 5 16 10 25 11 5 6 24 10 3 12 4 14 22 15 4 23 18 7 10 6 23 10 15 23 7 16 8 12 23 8 24 23 28 3 11 3 14 5 25 13 11 20 26 14 5 2 10 6\n36 31 1 0 29 26 9 22 15 27 15 3 19 5 26 15 7 7 1 26 24 0 3 15 21 10 2 2 26 17 26 26 29 15 15 8 7 23 21\n18 18 3 24 25 12 5 3 27 26 28 4 14 10 3 3 5 17 19 14 18\n84 50 2 15 23 21 17 28 10 2 5 25 14 6 0 20 21 21 16 18 6 11 15 23 26 20 7 7 29 3 13 26 12 3 28 0 3 9 7 25 17 27 16 15 25 5 18 28 27 11 4 25 26 2 24 13 26 26 25 19 12 17 21 10 15 23 20 22 0 12 29 8 5 2 24 0 15 12 14 3 12 5 7 7 6 27 0\n55 8 0 1 19 8 0 5 23 14 2 0 19 29 18 19 14 13 6 30 23 24 24 29 10 19 7 19 2 7 8 27 25 28 8 8 14 19 22 30 7 21 6 25 22 11 5 25 11 30 26 21 30 29 18 16 0 9\n11 2 4 9 28 27 8 8 8 9 26 8 9 8\n73 38 6 14 16 11 30 15 20 22 10 8 20 1 2 24 20 4 21 28 9 27 6 20 12 17 0 19 6 21 19 28 17 3 29 6 7 21 11 2 22 20 17 20 3 16 14 26 29 28 5 1 11 10 24 21 9 17 1 22 30 14 17 17 13 20 29 3 8 5 9 16 30 7 10 8\n1 0 9 15\n50 27 7 23 9 12 7 19 30 28 27 1 10 13 6 26 10 29 1 30 7 27 19 13 23 16 13 15 29 2 20 4 23 23 10 28 28 9 23 26 17 15 1 24 15 4 17 0 14 7 24 11 11\n7 3 3 5 5 14 1 21 5 6\n68 15 9 15 0 26 9 25 6 9 27 3 3 26 15 4 19 27 25 28 21 4 21 5 0 14 6 28 17 16 30 30 29 19 1 20 23 22 0 10 11 26 29 29 6 29 11 4 15 21 3 29 9 19 8 10 15 24 12 24 8 11 0 6 5 6 8 9 23 27 9\n62 22 6 1 16 3 17 1 15 13 11 11 11 6 17 26 1 24 0 13 15 11 3 22 11 18 28 22 19 12 22 26 10 10 11 2 15 6 12 30 5 25 14 26 9 7 8 9 8 29 17 24 3 0 0 28 28 6 9 10 11 25 4 19 23\n3 3 1 18 25 14\n84 61 6 9 4 26 8 4 14 24 3 20 3 16 23 13 28 13 21 11 28 21 18 26 8 30 11 1 6 8 6 21 28 4 18 18 4 16 27 30 22 10 15 23 11 18 10 21 11 24 30 27 10 8 2 13 28 26 27 10 1 14 22 5 5 7 18 18 3 4 5 19 20 28 6 21 25 17 16 24 27 17 0 21 10 4 22\n20 2 6 22 14 14 24 14 15 2 15 14 25 5 21 0 5 15 15 17 23 14 25\n77 27 5 14 15 11 10 11 12 12 12 29 22 11 11 19 12 24 12 12 13 17 2 18 26 14 12 12 10 11 25 29 28 12 11 12 12 11 25 3 12 11 11 11 29 11 12 19 12 27 6 4 16 21 11 6 12 12 11 9 11 19 11 12 11 2 16 15 12 8 20 7 12 11 11 11 11 27 12 11\n38 0 9 28 9 22 7 7 22 28 3 7 16 14 29 13 7 14 25 24 26 27 9 12 3 27 22 24 22 28 20 21 24 16 30 16 13 25 11 9 18\n28 0 9 3 10 4 23 28 23 1 24 23 15 23 24 18 23 6 20 24 21 24 24 28 10 18 30 22 23 24 21\n11 7 5 5 30 30 11 27 20 19 18 24 4 19\n67 26 8 23 16 22 4 28 15 27 20 26 2 6 17 29 25 0 14 16 20 14 29 30 2 15 1 16 15 1 9 7 2 0 7 8 8 28 29 6 22 3 21 23 0 22 22 25 15 29 26 13 26 21 22 19 30 18 17 23 12 23 20 20 0 7 9 14 18 19\n4 2 3 17 0 19 13\n14 6 5 8 12 17 11 26 12 11 20 12 12 29 11 12 0\n44 14 9 5 23 2 10 24 17 23 24 24 6 23 24 24 23 12 23 12 2 24 24 24 23 21 23 23 16 24 24 24 2 23 23 24 8 23 24 23 23 24 24 4 21 17 30\n66 47 9 9 8 28 25 4 13 22 25 22 24 7 20 22 18 2 5 12 26 25 20 27 20 1 2 27 17 26 16 25 2 11 0 1 24 1 18 9 14 4 4 16 18 12 25 15 15 17 10 11 6 14 0 8 29 14 2 28 28 12 10 19 8 30 22 13 17\n41 34 2 18 13 11 11 5 0 7 2 28 21 29 3 25 9 4 20 9 0 26 15 9 22 6 14 29 13 14 2 22 23 27 26 12 9 26 9 22 10 30 9 21\n66 31 9 14 23 13 24 20 19 27 23 24 24 23 10 24 24 6 23 24 24 23 24 24 0 24 26 23 23 23 5 2 23 4 23 24 23 24 23 25 21 9 24 21 23 23 23 23 8 23 23 24 23 24 0 24 23 23 12 5 23 25 9 22 17 14 30 8 26\n65 0 0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30\n37 0 10 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30\n49 0 5 9 4 7 9 15 24 16 13 13 30 8 16 14 7 9 7 27 7 19 15 30 5 27 1 28 13 23 28 3 1 4 2 0 18 18 29 15 10 20 12 29 17 7 7 8 11 3 9 27\n75 75 8 27 24 28 25 25 21 24 12 20 9 17 10 11 21 16 27 26 8 10 13 25 21 2 2 10 6 22 20 26 26 5 3 14 15 4 28 2 5 8 8 15 9 14 20 21 28 6 17 9 9 2 2 20 10 22 28 19 16 3 17 20 7 22 21 26 3 4 20 28 11 9 6 22 20 3\n59 59 0 24 19 10 8 3 15 9 14 22 16 10 9 28 18 2 13 21 16 26 2 28 27 26 7 16 5 28 4 4 21 2 4 19 6 9 21 19 5 28 7 26 20 23 12 25 3 18 24 13 24 10 10 24 24 20 4 24 13 18\n17 3 10 13 27 16 27 26 5 8 27 26 19 27 26 0 27 3 11 26\n87 8 4 0 14 8 18 14 15 8 4 9 26 11 7 9 11 8 13 9 8 8 9 9 9 8 30 4 20 9 20 9 8 1 18 5 9 8 8 8 9 9 16 8 8 23 9 9 9 8 3 13 17 18 8 8 18 9 9 7 6 21 9 9 7 11 22 8 9 8 30 8 16 8 8 19 9 27 30 0 7 15 25 9 19 8 9 9 9 8\n46 19 6 15 15 11 14 14 15 14 20 2 13 23 30 14 20 15 14 15 14 15 15 6 15 14 22 1 22 5 14 14 15 17 3 16 13 7 27 15 11 27 11 14 6 15 14 28 15\n53 53 0 13 7 4 6 6 4 21 8 16 21 28 27 18 2 19 17 14 26 5 17 5 23 8 23 2 14 6 15 27 14 8 28 24 15 26 26 21 10 26 27 25 14 25 23 28 5 28 2 22 18 19 20 26\n45 18 2 26 2 10 5 3 15 29 8 12 12 2 2 19 3 3 3 2 23 5 15 11 26 4 13 9 3 2 2 30 19 2 3 15 2 30 3 1 14 2 2 3 16 2 3 3\n71 35 3 6 5 18 6 6 5 5 26 14 0 7 18 6 3 5 6 18 5 28 24 5 5 6 6 19 6 14 5 5 6 7 17 6 6 10 15 17 5 6 9 11 17 6 5 5 12 5 18 0 1 6 17 22 6 6 6 6 5 23 11 6 6 5 6 5 9 18 5 17 6 27\n92 57 5 0 22 16 29 7 6 25 29 18 6 15 23 17 18 27 7 11 28 4 0 22 18 27 7 15 27 27 21 5 5 12 28 28 1 2 9 2 13 25 23 15 30 29 24 1 20 19 5 26 3 18 29 0 10 7 22 4 13 14 5 9 18 25 25 12 10 27 29 5 23 29 30 5 25 27 18 29 25 27 3 29 28 15 4 25 11 25 1 0 20 25 2\n90 36 7 18 19 19 22 7 0 18 1 17 15 28 18 18 18 6 17 18 2 10 3 15 18 17 25 20 18 17 17 19 18 17 18 18 18 2 10 4 17 11 18 9 18 18 17 26 18 3 14 18 17 19 7 17 29 18 24 1 18 26 18 1 18 20 18 18 3 18 30 18 17 17 10 17 28 17 18 18 4 14 18 18 18 18 10 18 9 21 3 6 17\n81 0 9 21 15 17 3 29 19 1 6 7 17 28 26 1 14 14 18 19 21 10 26 25 3 14 20 1 7 24 18 24 18 9 23 8 3 19 17 2 25 18 2 25 18 2 4 25 5 16 26 20 7 30 10 14 19 14 21 6 12 1 27 12 24 9 13 10 8 3 9 21 25 12 9 25 8 0 7 19 9 0 25 19\n25 6 6 7 27 14 5 2 30 18 30 27 4 24 16 24 0 30 17 12 4 28 4 5 19 1 9 30\n5 4 1 0 22 12 2 20\n17 0 7 23 14 3 1 13 8 22 22 2 4 18 11 21 18 24 21 25\n38 7 4 8 8 22 9 21 9 16 8 20 18 12 9 2 7 8 8 19 8 9 9 8 8 8 9 9 22 9 9 25 22 8 11 9 8 9 18 8 9\n34 5 6 22 15 15 16 21 15 14 15 4 15 14 15 15 17 22 15 7 15 15 5 15 14 14 23 30 4 6 15 10 14 20 14 0 15\n60 0 5 15 13 6 22 9 6 17 27 16 3 29 25 25 23 15 10 8 20 2 6 17 30 6 10 6 28 6 12 24 12 18 3 18 23 20 2 13 30 9 6 15 27 4 5 5 30 16 22 13 22 6 22 12 3 27 14 27 18 11 10\n63 40 0 13 23 4 13 16 22 20 16 27 11 14 29 9 25 5 15 27 13 23 22 15 28 12 0 5 17 9 16 23 12 23 9 3 25 29 10 22 6 12 10 30 15 27 2 9 15 8 28 21 22 3 12 25 15 26 14 20 30 0 27 21 9 3\n20 0 9 9 24 25 8 4 11 20 29 21 6 27 0 7 22 24 16 7 6 21 26\n23 0 10 29 19 22 18 11 27 22 18 22 7 2 12 11 25 8 21 4 11 13 9 13 3 19\n10 0 10 21 0 24 22 1 12 13 29 6 30\n5 5 7 24 20 11 20 13\n79 4 4 16 20 16 1 18 14 4 4 17 22 28 21 9 11 26 13 30 13 1 27 21 8 28 2 25 17 0 13 18 0 2 12 27 30 24 11 21 21 0 23 30 5 14 17 24 8 4 9 30 10 20 26 8 12 22 3 12 7 26 27 28 16 30 2 19 15 1 0 15 18 21 13 13 30 10 30 13 26 27\n74 21 5 11 12 11 11 6 12 26 12 12 12 25 4 15 30 23 12 14 11 1 26 12 11 5 12 11 12 11 11 11 12 9 12 14 12 12 13 23 9 22 19 28 12 12 11 12 6 15 3 11 10 16 12 12 12 8 12 11 12 16 18 11 6 24 12 14 11 7 11 11 12 11 1 8 25\n52 25 8 25 11 0 13 24 20 13 18 30 10 28 5 28 22 29 7 6 27 22 12 19 9 11 29 13 6 11 5 28 14 20 3 8 7 0 3 19 6 18 20 19 22 7 1 19 14 27 28 8 29 19 28\n88 21 9 28 10 26 19 30 23 2 29 21 4 4 16 8 20 9 12 3 19 16 10 19 28 0 22 17 19 11 11 5 17 28 25 3 5 23 25 24 24 21 15 13 17 23 9 6 15 30 14 26 3 27 12 29 28 28 0 15 6 14 7 14 12 8 10 2 24 21 26 14 0 18 21 7 13 2 29 18 16 3 26 3 21 20 9 23 18 29 9\n31 1 10 27 26 27 30 27 21 11 26 1 15 26 26 11 15 27 24 26 27 24 22 27 27 27 0 26 26 2 26 27 27 27\n71 28 6 0 8 6 2 20 29 14 27 6 27 22 10 10 8 17 11 24 9 12 10 20 0 29 8 5 15 17 25 21 16 6 3 3 27 15 4 23 13 16 19 3 15 13 17 2 18 9 14 9 20 12 7 27 20 5 25 17 11 17 30 1 18 8 16 0 20 3 3 8 8 27\n71 71 10 28 4 10 28 16 2 22 25 21 10 21 25 21 3 9 5 9 14 24 18 13 28 19 15 19 12 20 28 2 27 24 4 11 26 22 15 28 14 19 26 13 5 27 5 26 17 6 2 26 26 18 25 5 10 25 14 9 24 7 13 13 4 22 11 9 8 15 4 3 25 18\n63 0 3 7 4 7 0 15 26 7 26 4 21 28 11 2 6 22 8 24 22 18 3 3 8 10 28 20 2 6 26 19 15 28 9 8 20 24 0 21 22 6 26 22 27 27 13 3 14 28 29 9 8 27 18 4 26 9 18 26 14 21 0 25 28 6\n25 4 7 23 3 24 28 30 26 4 12 14 15 27 29 1 30 1 30 14 29 24 1 0 27 22 0 16\n100 49 6 3 21 17 12 25 26 8 30 9 10 15 19 7 28 3 0 16 4 17 26 19 16 27 15 10 20 9 1 29 10 27 30 23 28 28 11 18 27 5 17 22 29 6 12 1 10 29 8 13 9 8 23 21 5 24 12 16 14 15 2 10 0 3 19 27 23 20 3 30 30 18 12 5 1 19 13 20 16 10 1 26 8 20 29 28 28 23 8 14 16 23 1 12 2 22 5 14 25 29 26\n43 17 6 29 30 11 0 2 0 15 22 26 3 10 12 4 24 18 12 25 7 17 6 22 21 4 29 28 20 29 25 27 30 11 24 20 5 20 14 6 6 24 5 19 29 10\n99 76 3 4 27 13 17 15 4 13 0 20 24 9 17 9 25 24 27 9 7 8 24 6 12 28 1 28 9 17 14 13 6 20 7 29 6 7 15 4 10 21 18 14 5 2 1 23 27 1 8 30 9 14 20 12 20 20 29 6 29 22 25 21 24 20 12 15 0 3 0 17 7 15 8 8 9 21 26 7 26 11 5 9 21 19 16 30 10 5 9 2 23 27 19 5 5 15 16 22 14 29\n39 10 5 11 4 11 16 12 28 11 10 18 20 3 5 12 22 12 13 16 14 11 9 20 25 22 11 24 10 19 1 12 11 28 14 11 20 2 11 11 1 11\n96 32 6 14 8 4 15 14 24 29 14 15 15 14 14 15 14 14 7 15 14 14 4 5 23 13 14 0 29 2 3 21 30 14 1 14 15 15 14 24 15 16 14 15 14 13 14 15 14 24 20 10 15 14 14 15 8 15 15 14 14 15 14 17 21 11 1 25 16 8 3 15 29 14 15 15 26 14 15 15 14 17 28 15 15 15 14 14 15 10 19 18 23 18 10 15 15 14 19\n39 7 2 1 16 3 22 17 6 3 29 4 5 1 25 2 17 8 6 25 7 22 29 3 19 27 29 17 3 6 1 21 11 25 1 21 3 24 26 22 10 29\n89 18 3 21 27 5 7 13 18 8 10 13 19 0 8 30 30 23 21 16 21 7 5 14 24 23 6 30 25 11 22 28 29 21 10 11 2 11 5 20 17 15 19 1 30 23 25 16 0 7 15 18 11 10 16 22 30 12 11 21 0 9 26 8 24 15 5 21 10 7 22 5 14 12 27 13 2 21 12 29 2 12 15 19 7 21 6 30 26 9 18 5\n94 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n80 5 4 17 18 2 8 9 9 18 29 0 9 9 2 4 9 9 8 20 18 10 12 22 30 8 12 8 22 9 27 17 8 8 8 9 9 9 9 9 9 24 8 8 8 4 8 3 9 14 12 25 0 15 9 29 8 28 8 8 2 12 19 15 30 20 8 8 27 9 28 8 19 9 8 13 20 9 18 8 16 8 4\n69 22 0 0 13 29 3 24 18 5 28 20 8 22 21 27 6 29 15 3 20 12 15 23 16 0 26 14 23 20 29 27 27 10 15 30 1 7 12 7 28 27 24 1 6 23 3 14 7 13 2 17 6 4 27 4 22 29 7 14 16 13 2 26 3 3 9 28 10 8 1 23\n3 1 8 4 1 23\n73 30 5 12 11 23 12 11 8 12 16 12 11 23 12 7 12 19 12 1 11 11 12 11 11 4 12 22 4 7 11 12 11 27 11 11 14 26 15 11 18 2 12 12 11 12 12 12 26 12 12 11 11 11 6 21 16 17 8 25 1 11 10 23 2 14 21 11 7 11 6 12 16 12 11 19\n52 22 9 24 8 17 23 11 23 23 24 24 24 23 8 3 24 23 24 23 24 24 25 13 5 23 24 20 24 3 24 24 23 21 20 23 17 24 21 17 28 9 23 23 19 24 23 23 11 23 24 24 23 24 24\n97 97 3 21 20 27 9 18 21 23 13 9 3 23 4 17 4 27 19 4 20 17 26 20 13 22 22 5 17 27 7 23 27 7 17 26 8 14 24 25 7 9 21 26 19 15 21 19 19 24 26 5 23 21 6 18 18 24 22 3 28 15 25 14 2 14 19 24 7 13 22 6 13 6 22 28 7 3 23 12 18 5 27 16 15 24 24 27 26 27 13 18 20 16 6 8 23 11 22 12\n89 25 3 26 25 5 22 5 5 0 6 2 5 6 6 21 12 10 5 11 20 2 5 5 17 5 6 7 6 6 6 6 16 15 5 5 6 20 6 5 8 13 6 5 5 18 6 4 6 6 6 5 27 19 6 0 5 5 5 22 5 30 11 5 23 7 7 6 5 3 26 6 8 20 2 6 5 6 5 25 4 21 7 19 7 6 6 5 6 5 16 22\n82 0 10 28 10 23 18 25 23 9 2 16 15 0 14 9 0 4 27 21 20 13 12 23 24 11 5 8 2 24 18 28 6 16 11 17 17 27 28 9 21 30 13 30 17 24 12 6 9 26 27 30 29 0 22 6 23 5 8 10 8 8 24 17 23 8 25 28 27 8 24 8 5 26 13 12 5 26 9 30 6 28 2 15 1\n76 0 6 3 4 4 2 29 22 4 28 26 0 21 23 3 9 24 1 2 20 8 10 20 23 26 25 9 28 30 17 2 28 20 13 23 26 23 14 15 15 30 13 10 22 22 20 7 10 24 23 20 22 21 17 15 26 14 2 26 27 10 5 29 1 2 5 25 2 12 16 26 16 12 0 25 21 9 10\n60 10 4 19 8 30 9 25 8 0 19 8 16 22 9 29 9 8 9 7 8 22 9 18 7 14 9 8 8 5 8 18 9 9 23 1 8 8 27 18 17 30 4 13 8 8 8 21 27 13 21 28 0 4 9 8 23 16 1 22 9 8 10\n91 3 3 7 6 1 5 14 2 5 6 23 19 5 6 13 23 14 14 5 1 5 24 12 5 5 18 5 6 6 28 6 6 6 5 5 5 7 5 27 6 22 21 13 5 6 28 6 5 6 6 7 30 2 22 6 6 6 23 2 6 5 6 12 6 5 6 5 4 7 13 4 21 11 18 17 3 10 20 7 15 26 5 6 23 6 6 12 4 6 5 10 26 6\n22 9 1 4 4 2 1 23 15 13 0 1 0 23 17 4 23 24 10 29 14 24 14 2 3\n6 0 10 19 25 15 12 21 10\n22 13 8 16 24 8 0 21 22 29 24 18 14 29 29 3 0 11 16 28 19 7 7 0 26\n";
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String[][] cases = CaseReader.getCases(val, 1);
		for (int i = 0;i < cases.length;i++)
		{
			parseCase(i + 1, cases[i][0]);
		}
	}
	
	static void parseCase(int caseNum, String caseString) {
		String[] args = caseString.split(" ");
		int googleCount = Integer.parseInt(args[0]);
		int surprises = Integer.parseInt(args[1]);
		int lowest = Integer.parseInt(args[2]);
		int[] googleScores = new int[googleCount];
		for (int i = 0;i < googleCount;i++)
		{
			googleScores[i] = Integer.parseInt(args[i + 3]);
		}
		int countAbove = getCasesWhereAbove(lowest, surprises, googleScores);
		System.out.println("Case #" + caseNum + ": " + countAbove);
	}
	
	static int getCasesWhereAbove(int minimum, int surpriseCount, int[] scores) {
		int count = 0, currentSurprises = 0;
		for (int i = 0;i < scores.length;i++) {
			if ((scores[i] + 2) / 3 >= minimum) { // This one naturally works, so it's fine.
				count++;
			} else if (scores[i] >= minimum && (scores[i] + 4) / 3 >= minimum && currentSurprises < surpriseCount) {
				count++;
				currentSurprises++;
			}
		}
		return count;
	}

}
