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.*;
import java.util.*;

public class taskB {

	PrintWriter out;
	BufferedReader br;
	StringTokenizer st;

	String nextToken() throws IOException {
		while ((st == null) || (!st.hasMoreTokens()))
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public void solve() throws IOException {
		int n = nextInt();
		int s = nextInt();
		int p = nextInt();
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int a = nextInt();
			if (p > a)
				continue;
			if (p  * 3 - 2 <= a) {
				ans++;
				continue;
			}
			if (s == 0)
				continue;
			if (p * 3 - 4 <= a) {
				s--;
				ans++;
			}
		}
		out.println(ans);
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			br = new BufferedReader(new FileReader("taskB.in"));
			out = new PrintWriter("taskB.out");
			int n = nextInt();
			for (int i = 0; i < n; i++) {
				out.print("Case #" + (i + 1) + ": ");

				solve();
			}

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new taskB().run();
	}
}
