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.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		InputStream in = System.in;
		PrintStream out = System.out;
		if (args.length > 0) {
			try {
				in = new FileInputStream(args[0]);
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		Scanner scanner = new Scanner(in);
		int cases = scanner.nextInt();
		for (int i = 1; i <= cases; ++i) {
			int n = scanner.nextInt();
			int s = scanner.nextInt();
			int p = scanner.nextInt();
			int good = 0;
			int surprising = 0;
			for (int j = 0; j < n; ++j) {
				int t,q,r;
				t = scanner.nextInt();
				if (t > 0) {
					--t;
					r = t % 3;
					q = t / 3;
					if (q + 1 >= p) {
						++good;
					} else if (r > 0 && q + 2 >= p) {
						++surprising;
					}
				} else if (p == 0) {
					++good;
				}
			}
			
			
			out.format("Case #%d: ",i);
			out.print(good + Math.min(s, surprising));
			out.println();
		}
	}
}