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

package y2012;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

public class DancingWiththeGooglers {
    static public void main(String args[]) throws IOException {
        System.setIn(new FileInputStream("src/y2012/B-large.in"));
        // System.setIn(new FileInputStream("src/y2012/B-small-attempt0.in"));
        BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new FileWriter("src/y2012/B-large.out"));
        // BufferedWriter wr = new BufferedWriter(new FileWriter("src/y2012/B-small-attempt0.out"));
        int nTests = Integer.valueOf(cin.readLine());
        String line;
        int tid = 0;
        while ((line = cin.readLine()) != null) {
            String[] sa = line.split("\\s+");
            int N = Integer.parseInt(sa[0]);
            int S = Integer.parseInt(sa[1]);
            int p = Integer.parseInt(sa[2]);
            int rlst = 0, a1 = 0, a2 = 0;
            for (int i = 0; i < N; i++) {
                int tii = Integer.parseInt(sa[i + 3]);
                if (tii >= p)
                    if (tii >= 3 * p + 5)
                        rlst++;
                    else if (tii <= 3 * p + 4 && tii >= 3 * p - 2)
                        a1++;
                    else if (tii == 3 * p - 3 || tii == 3 * p - 4)
                        a2++;
            }
            rlst += a1;
            rlst += Math.min(S, a2);
            ++tid;
            wr.write("Case #" + tid + ": " + rlst + "\n");
        }
        wr.close();
        cin.close();
    }
}