import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class DancingWithTheGooglers {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader (new FileReader("B-small.in"));
		PrintWriter out = new PrintWriter(new FileWriter("B-small.out"));
		
		int t = Integer.parseInt(f.readLine());
		for (int i = 0; i < t; i++){
			int c = 0;
			StringTokenizer st = new StringTokenizer(f.readLine());
			int n = Integer.parseInt(st.nextToken());
			int[] ti = new int[n];
			int s = Integer.parseInt(st.nextToken());
			int p = Integer.parseInt(st.nextToken());
			for (int j = 0; j < n; j ++){
				ti[j] = Integer.parseInt(st.nextToken());
				if (ti[j] % 3 == 0){
					if (ti[j] / 3 >= p)
						c++;
					else if (ti[j] / 3 == (p-1) && s > 0 && ti[j] >= 2){
						s--;
						c++;
					}
				}
				else if (ti[j] % 3 == 1){
					if ((ti[j] / 3) + 1 >= p)
						c++;					
				}
				else{
					if (ti[j] / 3 >= p-1)
						c++;
					else if (ti[j] / 3 == (p-2) && s > 0){
						s--;
						c++;
					}
				}
					
				
			}
			out.println("Case #" + (i+1) + ": " + c);
			
			
		}
		out.close();
		System.exit(0);
		
		
		
	}
}

package com.parijat;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class Sol2 {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("./input.txt")));
		FileOutputStream fos = new FileOutputStream("output.txt");
		int testcases = Integer.parseInt(reader.readLine());
		for(int i=0; i< testcases; i++) {
			String[] temp = reader.readLine().split(" ");
			int dancers = Integer.parseInt(temp[0]);
			int surprises = Integer.parseInt(temp[1]);
			int min_best_score = Integer.parseInt(temp[2]);
			
			int t = min_best_score - 2;
			if(t< 0) {
				t = 0;
			}
			int min_score_with_surprise = min_best_score + 2*t;
			
			t = min_best_score - 1;
			if(t< 0) {
				t = 0;
			}
			int min_score_normal = min_best_score + 2*t;
			
			int success = 0;
			for(int j=3; j<temp.length; j++) {
				int score = Integer.parseInt(temp[j]);
				if(score >= min_score_normal) {
					success++;
				} else if(score >= min_score_with_surprise && surprises > 0) {
					surprises--;
					success++;
				}
			}
			fos.write(("Case #" + (i+1) + ": " + success + "\n").getBytes());
		}
		
	}

}
