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


public class Dancing {

	
	public static void main(String[] args) throws IOException 
	{
		File file = new File("B-small-attempt0.in");
		Scanner scanner;
		BufferedWriter out = new BufferedWriter(new FileWriter("outfile"));
		
		try
		{
			scanner = new Scanner(file);
			int testCases = scanner.nextInt();
			scanner.nextLine();  
			
			for(int numTest=0; numTest<testCases; numTest++)
			{
				int N = scanner.nextInt();
				int S = scanner.nextInt();
				int P = scanner.nextInt();
				int[] total = new int[N];
				for(int i=0; i<N; i++)
				{
					total[i]=scanner.nextInt();
				}
				
				scanner.nextLine();
				
				int count=0;
				for(int i=0; i<N; i++)
				{
					if(total[i]==0)
					{
						if(P==0)
							count++;
					}
					else if(total[i]<=3)
					{
						if(P<=1)
							count++;
					}
					else
					{
					
						int avg = total[i]/3;
						int mod = total[i]%3;
						if(mod==0)
						{
							if(avg>=P)
								count++;
							else
							{
								if((avg+1>=P)&&(S>0))
								{
									count++;
									S--;
								}
							}
						}
						if(mod==1)
						{
							if(avg+1>=P)
								count++;
						}
						if(mod==2)
						{
							if(avg+1>=P)
								count++;
							else
							{
								if((avg+2>=P)&&(S>0))
								{
									count++;
									S--;
								}
							}
						}	
					}
				}
				out.write("Case #"+(numTest+1)+": "+ count +"\n");
			}
			
			out.close();
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		
	}
}
