/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

import java.util.*;

public class Dancing {
	
	public static boolean wasS(int score){
		switch(score) {
			case 0:
				return false;
			case 1:
				return false;
			case 30:
				return false;
			case 29:
				return false;		
		}
		int resi = score%3;
		if(resi == 1){
			return false;
		}
		return true;
	}
	
	public static int maxp(int score, boolean surpr){
		switch(score) {
			case 0:
				return 0;
			case 1:
				return 1;
			case 30:
				return 10;
			case 29:
				return 10;		
		}
		int mid = score/3;
		int resi = score%3;
		switch (resi) {
			case 0:
				if(surpr)
					return mid+1;
				else 
					return mid;
			case 1:
				return mid+1;
			case 2:
				if(surpr)
					return mid+2;
				else
					return mid+1;
		}
		return mid;
	}
	
	public static int solve( int n, int sur, int p, int[] sc){
		
		int abovep = 0;
		for(int i = 0; i<sc.length; i++){
			int maxpos = maxp(sc[i], false);
			if(maxpos >= p ){
				abovep++;
			}else {
				if(sur > 0){
					maxpos = maxp(sc[i], true);
					//wasSurpr = wasS(sc[i]);
					if(maxpos >= p){
						abovep++;
						sur--;				
					}
				}
			}
	//		System.out.println(sc[i]+" max "+maxpos);
	//		System.out.println(" abovep "+abovep+" sur "+sur);

		}
		return abovep;
	}
	
	public static void main(String args[]){
	
		Scanner s = new Scanner(System.in);
		int T = s.nextInt();
		
		for(int i = 1; i<=T; i++){
			int n = s.nextInt();
			int sur = s.nextInt();
			int p = s.nextInt();
			int sc[] = new int[n];
			for(int j = 0; j<n; j++){
				sc[j] = s.nextInt();
			}
			int y = solve(n, sur, p, sc);
			System.out.println("Case #"+i+": "+y);
		}

	}
}