import java.util.Scanner;
public class B {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		for(int zz = 1; zz <= T;zz++){
			int N = in.nextInt();
			int S = in.nextInt();
			int p = in.nextInt();
			int x = 0;
			for(int i = 0; i < N;i++){
				int score = in.nextInt();
				int best = score/3;
				int mod = score%3;
				int diff = p-best;
				if(diff<1){
					x++;
				}else if(diff<2){
					if(mod==0 && score !=0){
						if(S!=0){
							S--;x++;
						}
					}else if(score!=0){
						x++;
					}
				}else if(diff<3){
					if(mod==2){
						if(S!=0){
							S--;x++;
						}
					}
				}
			}
			System.out.format("Case #%d: %d\n", zz, x);
		}
	}
}

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class DancingWithTheGooglers {
	public static void main(String[] args) {
		try {
			System.setOut(new PrintStream(new FileOutputStream("output.txt")));
			Scanner scanner = new Scanner(new File(args[0]));
			int testsNum = scanner.nextInt();
			
			String solution;
			for (int i=1; i<=testsNum; i++) {
				solution = solve(scanner);
				System.out.println("Case #"+i+": "+solution);
				System.err.println("Case #"+i+": "+solution);
			}
		} catch (Exception e) {e.printStackTrace();}
	}
	
	private static String solve(Scanner scanner) {
		int n = scanner.nextInt();
		int s = scanner.nextInt();
		int p = scanner.nextInt();
		
		int score;
		int ret = 0;
		for (int i=0; i<n; i++) {
			score = scanner.nextInt();
			if (score >= 3*p-2) ret++;
			else if (score >= 3*p-4 && score >= 2) {
				if (s-->0) ret++;
			}
		}
		
		return ""+ret;
	}
}
