import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        B th = new B();
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            int[] t = new int[n];
            for (int j = 0; j < n; j++) {
                t[j] = sc.nextInt();
            }
            int c = th.getAnswer(s,p,t);
            System.out.println("Case #" + (i+1) + ": " + c);
        }
    }
    public int getAnswer(int s, int p, int[] t) {
        int A1 = p + p-1+p-1;
        int A2 = p + p-2+p-2;
        if (A1 < 0)
            A1 = 0;
        if (A2 < 0)
            A2 = 1;
        int remain = s;
        int count = 0;
        int n = t.length;
        for (int i = 0; i < n; i++) {
            if (t[i] >= A1) {
                count++;
            } else if (t[i] < A1 && t[i] >= A2) {
                if (remain > 0) {
                    remain--;
                    count++;
                }
            }
        }
        return count;
    }
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;


public class Dancing {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			// Open the file that is the first
			// command line parameter
			FileInputStream fstream = new FileInputStream(
					"B-large.in");

			// Convert our input stream to aw
			// DataInputStream
			DataInputStream in = new DataInputStream(fstream);

			FileOutputStream out = new FileOutputStream(
					"B-large.out");
			PrintStream p = new PrintStream(out);

			int lineNo = 1;
			// Continue to read lines while
			// there are still some left to read
			while (in.available() != 0) {
				if (lineNo == 1) {
					cases(in.readLine(), in, p);
				}
				lineNo++;
			}

			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
	private static void cases(String firstLine, DataInputStream in,
			PrintStream p) throws IOException {
		int casesNo = Integer.parseInt(firstLine);
		for (int i = 0; i < casesNo; i++) {
			// System.out.print("Case #" + (i + 1) + ": ");
			p.print("Case #" + (i + 1) + ": ");
			String line = in.readLine();
			googlers(line, p);
		}

	}

	private static void googlers(String line, PrintStream p) {
		
		String lines[] = line.split(" ");
		int suprises = Integer.parseInt(lines[1]);
		int reqP = Integer.parseInt(lines[2]);
		int result = 0;
		int number=0;
		int quo = 0;
		int rem = 0;
		for(int i = 3;i<lines.length;i++)
		{
			number =Integer.parseInt(lines[i]);
			if(number==0 && reqP==0)
			{
				
				result=result+1;
				continue;
			}
			if(number ==0 )
				continue;
			quo = number/3;
			rem = number%3;
			rem = rem==0? 0 : 1;
			if(quo>=reqP || (rem+quo)>=reqP)
			{
				result=result+1;
				continue;
			}
			else 
			{
				if(suprises>=1)
				{
					number +=2;
					quo = number/3;
					rem = number%3;
					rem = rem==0? 0 : 1;
					if(quo>=reqP || (rem+quo)>=reqP)
					{
						result=result+1;
						suprises=suprises-1;
						continue;
					}
				
				}
					
			}
		}
		p.println(result+"");
	}

}
