import java.util.List;


public class Case implements Runnable {

	private int id;
	private String output;

	private int n;
	private int s;
	private int p;
	private List<Integer> g;

	public Case(int id) {
		this.id = id;
	}

	public Case(int id, int n, int s, int p, List<Integer> g) {
		super();
		this.id = id;
		this.n = n;
		this.s = s;
		this.p = p;
		this.g = g;
	}

	public String solve() {
		int res = 0;
		for (int googler : g) {
			int b = googler / 3;
			boolean div = googler % 3 == 0;
			if (b >= p) {
				res++;
				continue;
			}
			if (p == b+1) {
				if (div && s > 0 && b > 0) {
					res++;
					s--;
					continue;
				}
				if (!div) {
					res++;
					continue;
				}
			}
			if (p == b+2) {
				if (3*b+2 == googler && s > 0) {
					res++;
					s--;
				}
			}
		}
		return String.valueOf(res);
	}

	@Override
	public void run() {
		output = solve();
	}

	@Override
	public String toString() {
		return "Case #" + id + ": " + output;
	}

}
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Scanner;

public class Dancing {
	public static void main(String args[]) {
		try{
		     BufferedReader in = new BufferedReader(new FileReader("B-small-attempt0.in"));
			 BufferedWriter out = new BufferedWriter(new FileWriter("B-small-attempt0.out"));
			
			 String line = in.readLine();
			 int caseCount = Integer.parseInt(line);
			 
			 StringBuffer outputWriter = new StringBuffer();
			 
			 int googlerCount, specialCount, bestCutoff, total, best, resultCount;
			 
			 for(int i = 1; i <= caseCount; i++){
				 line = in.readLine();
				 Scanner s = new Scanner(line);
				 googlerCount = s.nextInt();
				 specialCount = s.nextInt();
				 bestCutoff = s.nextInt();

				 resultCount = 0;
				 
				 for(int j = 0; j < googlerCount; j++){
					 total = s.nextInt();
					 best = (total + 2)/3;
					 
					 if(best >= bestCutoff)
						 resultCount++;
					 else if(best == (bestCutoff - 1) && total > 1 && total < 29 ){
						 if(specialCount > 0){
							 if( (total%3) != 1){//potential to specialize)
								 specialCount--;
								 resultCount++;
							 }
						 }
					 }
					 
					 //System.out.println(total + " " + best);
				 }
				 
				 outputWriter.append("Case #" + i + ": ");
				 outputWriter.append(resultCount);
				 if(i != caseCount)
					 outputWriter.append("\n");
			 }

			 out.write(outputWriter.toString()); 
			 System.out.println(outputWriter.toString());
			 
			 in.close();
			 out.close();
		} catch(Exception e){
			//swallow the exception
		}		
	}
}
