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.File;
import java.io.FileNotFoundException;
import java.util.LinkedList;
import java.util.Scanner;


public class dancing {
	
	public static int maxScore(int a){
		if(a==0) return 0;
		return ((a%3)==0)?(a/3)+1:(a%3)+a/3;
	}
	
	public static int maxScoreSanSurprise(int a){
		return (a/3)+Math.min(1, a%3);
	}
	
	public static int solveOne(Scanner scan){
		int n = scan.nextInt();
		int s = scan.nextInt();
		int p = scan.nextInt();
		int nbok =0;
		LinkedList<Integer> possible = new LinkedList<Integer>();
		for(int i=0; i<n; i++){
			int tmp = scan.nextInt();
			if(maxScoreSanSurprise(tmp)>=p){
			//	System.out.println("sans surprise"+tmp);
				nbok++;
			}
			else if(maxScore(tmp)>= p){
				//System.out.println("avec surprise"+tmp);
				possible.add(tmp);
			}
			else{
				//System.out.println("impossible"+tmp+" "+maxScore(tmp)+" "+maxScoreSanSurprise(tmp));
			}
		}
		return nbok+Math.min(s, possible.size());
	}
	
	public static void main(String[] args) throws FileNotFoundException{
		Scanner s = new Scanner(new File("input.txt"));
		int nbcas = s.nextInt();
		for(int i=0; i<nbcas; i++){
			System.out.println("Case #"+(i+1)+": "+solveOne(s));
		}
	}
}
