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

import java.util.*;

public class Problem2 {
	public Problem2(){
		Scanner scan = new Scanner(System.in);
		int inputs = scan.nextInt();
		for(int i=1; i<=inputs; i++){
			int googlers = scan.nextInt();
			int sur = scan.nextInt();
			int bResult = scan.nextInt();
			int num = 0;
			int[] results = new int[googlers];
			for(int j=0; j<googlers; j++){
				results[j]=scan.nextInt();
			}
			num = calc(googlers, sur, bResult, results);
			System.out.println("Case #"+i+": "+num);
		}
	}
	
	public int calc(int g, int s, int bS, int[] r){
		int[][] score = new int[g][5];
		for(int i=0; i<g; i++){
			if(r[i]%3 == 0){
				score[i][0] = 0;
				score[i][1] = r[i]/3;
				score[i][2] = r[i]/3;
				score[i][3] = r[i]/3;
				score[i][4] = 1;
			}else{
				double h = r[i];
				h = h/3;
				if(Math.floor(h) == Math.round(h)){ //means the value is x.3333, should now add two rounded down and add one rounded up
					score[i][0] = 0;
					score[i][1] = (int)Math.floor(h);
					score[i][2] = (int)Math.floor(h);
					score[i][3] = (int)Math.ceil(h);
				}else{ //catches values with x.6666, should now add two rounded up and add one rounded down
					score[i][0] = 0;
					score[i][1] = (int)Math.floor(h);
					score[i][2] = (int)Math.ceil(h);
					score[i][3] = (int)Math.ceil(h);
					score[i][4] = 1;
				}
			}
			if(score[i][1]>=bS || score[i][2]>=bS || score[i][3]>=bS){
				score[i][0]=1;
			}
		}
		int x = 0;
			List<Integer> z = new ArrayList<Integer>();
			for(int i=0; i<g; i++){
				if(score[i][0] != 1){
					z.add(i);
					x++;
				}
			}
			int f = 0;
			for(int a:z){
				if(score[a][3] >= bS-1 && f<s && score[a][1]+score[a][2]+score[a][3]>1 && score[a][4]==1){
					f++;
				}
			}	
			x = x-f;
		return g-x;
	}
	
	public static void main(String[] args){
		new Problem2();
	}
}
