import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class DancingWithTheGooglers {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader (new FileReader("B-small.in"));
		PrintWriter out = new PrintWriter(new FileWriter("B-small.out"));
		
		int t = Integer.parseInt(f.readLine());
		for (int i = 0; i < t; i++){
			int c = 0;
			StringTokenizer st = new StringTokenizer(f.readLine());
			int n = Integer.parseInt(st.nextToken());
			int[] ti = new int[n];
			int s = Integer.parseInt(st.nextToken());
			int p = Integer.parseInt(st.nextToken());
			for (int j = 0; j < n; j ++){
				ti[j] = Integer.parseInt(st.nextToken());
				if (ti[j] % 3 == 0){
					if (ti[j] / 3 >= p)
						c++;
					else if (ti[j] / 3 == (p-1) && s > 0 && ti[j] >= 2){
						s--;
						c++;
					}
				}
				else if (ti[j] % 3 == 1){
					if ((ti[j] / 3) + 1 >= p)
						c++;					
				}
				else{
					if (ti[j] / 3 >= p-1)
						c++;
					else if (ti[j] / 3 == (p-2) && s > 0){
						s--;
						c++;
					}
				}
					
				
			}
			out.println("Case #" + (i+1) + ": " + c);
			
			
		}
		out.close();
		System.exit(0);
		
		
		
	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;


public class ProblemB {
	public static void main(String [] args) throws NumberFormatException, IOException
	{
		BufferedReader r = new BufferedReader( new FileReader("C:\\Users\\ÐÐÐ\\Downloads\\B-small-attempt1.in"));
		ArrayList<String> s = new TestCaseReader().read(r);
		s = new ProblemB().remap(s);
		OutputPrinter p = new OutputPrinter();
		for (String str : s)
			p.print(str);
		p.m_writer.flush();
		p.m_writer.close();
		
	}

	private ArrayList<String> remap(ArrayList<String> s) {
		ArrayList<String> remapped = new ArrayList<String>();
		for (String str : s)
		{
			
			StringTokenizer tk = new StringTokenizer(str, "  ");
			
			int n_googlers = Integer.parseInt(tk.nextToken());
			int n_surprises = Integer.parseInt(tk.nextToken());
			int target_score = Integer.parseInt(tk.nextToken());
			int total = 0;
			
			for (int i = 0 ; i < n_googlers ; i ++ )
			{
				int score = Integer.parseInt(tk.nextToken());
				int score_div = score % 3;
				int score_avg = score /3;
				
				if (score < target_score)
					continue;
				
				if (score_avg  >= target_score&& score_div == 0)
					total++;
				else
				if (score_div > 0 && score_avg  >= target_score -1 )
				{
					total++;
				}
				else
				if (n_surprises > 0)
				{
					int avg_rest_of_score = (score - target_score)/2;
					if (score_avg >= target_score -2 && (target_score - avg_rest_of_score) <= 2)
					{
						total ++;
						n_surprises --;
					}
				}
				
			}
			remapped.add("" +total);
		}
		return remapped;
	}
}
