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.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;


public class googler {

	/**
	 * @param args
	 */
	static Scanner kb ;
	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
PrintWriter out = new PrintWriter("answergoogler.txt");
		 kb = new Scanner(System.in);
		int testcase = kb.nextInt();
		for(int i=0;i<testcase;i++){
			out.println("Case #"+(i+1)+": "+solve());
			//solve();
		}
		out.close();
	}
	private static int solve() {
		// TODO Auto-generated method stub
		String question ="";
		int answer = 0;
		int numberofpeople = kb.nextInt();
		question+=numberofpeople+" ";
		int surprise = kb.nextInt();
		int minimum = kb.nextInt();
		question+=surprise+" "+minimum+" ";
		int[] peoplearray = new int[numberofpeople];
	for(int i=0;i<numberofpeople;i++){
		peoplearray[i]= kb.nextInt();
		question+=peoplearray[i]+" ";
	}
	for(int i=0; i<numberofpeople;i++){
		int total = peoplearray[i];
		if(total==0){
			if(minimum==total){
				answer++;
			}
			continue;
		}
		int divided = total/3;
		int left = total%3;
		if(divided>=minimum){
			answer++;
			continue;
		}else if(left==0&&Math.abs(divided-minimum)==1&&surprise!=0){
			answer++;
			surprise--;
			continue;
		}else if(divided+left>=minimum){
			int first = minimum;
			
			left = left- (first-divided);
			int divided2 = (total-first)/2;
			if(first-divided==2){
				if(surprise>0){
					answer++;
					surprise--;
					
				}
			}else{
				
				answer++;
			}
			
		}
		
	}
	System.out.println(question+" and answer is "+ answer);
	return answer;
	//
	}

}
