import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class GooglersDancer {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		InputStreamReader converter = new InputStreamReader(System.in);
		BufferedReader in = new BufferedReader(converter);
		if (in == null) {
		      return;
		    }
		String numTest = in.readLine();
		int maxCases = Integer.valueOf(numTest);
		for(int i=1;i<= maxCases;i++){
			String linea = in.readLine();
			String[] datos = linea.split(" ");
			Integer googlers = Integer.valueOf(datos[0]);
			Integer sospechosos = Integer.valueOf(datos[1]);
			Integer p = Integer.valueOf(datos[2]);
			Integer puntuacion;
			Integer personas = 0;
			ArrayList<Integer> puntuaciones = new ArrayList<Integer>();
			for(int j=0;j<googlers;j++){
				puntuacion = Integer.valueOf(datos[3+j]);
				puntuaciones.add(puntuacion);
			}
			Integer[] pOrdenado = null;
			pOrdenado = (Integer[]) puntuaciones.toArray(new Integer[puntuaciones.size()]);
			Arrays.sort(pOrdenado);
			int j;
			for(j=pOrdenado.length-1;j>=0;j--){
				if(pOrdenado[j] >= p*3-2){
					personas += 1;
				}else{
					break;
				}
			}
			int posibles = j+1-sospechosos;
			for(;j>=posibles && j>= 0;j--){
				if(pOrdenado[j] >= p*3-4 && pOrdenado[j] > p){
					personas += 1;
				}else{
					break;
				}
			}
			System.out.println("Case #"+i+": "+personas);
		}
	}

}

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);
		}

	}
}