import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;

public class b {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedInputStream(System.in));

        int T = sc.nextInt();

        for (int casenumber = 1; casenumber <= T; ++casenumber) {

            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();

            int[] ts = new int[n];
            for (int i = 0; i < n; ++i)
                ts[i] = sc.nextInt();

            int thresh1 = (p == 1 ? 1 : (3 * p - 4));
            int thresh2 = (3 * p - 2);

            int count1 = 0, count2 = 0;

            for (int i = 0; i < n; ++i) {
                if (ts[i] >= thresh2) {
                    ++count2;
                    continue;
                }
                if (ts[i] >= thresh1) {
                    ++count1;
                }
            }

            if (count1 > s) {
                count1 = s;
            }

            System.out.format("Case #%d: %d%n", casenumber, count1 + count2);
        }
    }
}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.PrintWriter;


public class bsp2 {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		String inFile = "B-small-attempt0.in";
		String outFile = inFile + ".out";
		
		LineNumberReader lin = new LineNumberReader(new InputStreamReader(new FileInputStream(inFile)));
		PrintWriter out = new PrintWriter(new File(outFile));
		int NCASE = Integer.parseInt(lin.readLine());
		String line="";
		int erg=0;
		for(int CASE = 1; CASE <= NCASE; CASE++) {
			String [] ch=lin.readLine().split(" ");
			int googlers=Integer.parseInt(ch[0]);
			int sTriplets=Integer.parseInt(ch[1]);
			int bResult=Integer.parseInt(ch[2]);
			//System.out.println("Case #"+CASE);
			//System.out.println(googlers);
			//System.out.println(sTriplets);
			//System.out.println(bResult);
			for(int SCORE=3;SCORE<ch.length;SCORE++){
				//System.out.print(ch[SCORE]);
				int base=Integer.parseInt(ch[SCORE])/3;
				switch(Integer.parseInt(ch[SCORE])%3){
					case 0:
						if(base >=bResult) erg++;
						else{
							if(sTriplets>0 && base>0 && base+1 >=bResult){
								erg++;
								sTriplets--;
							}
						}
						break;
					case 1:
						if(base>=bResult||base+1>=bResult) erg++;
						else{
							if(sTriplets>0 && base>0 && base+1 >=bResult){
								erg++;
								sTriplets--;
							}
						}
						break;
					case 2:
						if(base+1>=bResult||base>=bResult) erg++;
						else{
							if(sTriplets>0 && base>0 && base+2 >=bResult){
								erg++;
								sTriplets--;
							}
						}
						break;
				}
			}
			out.println("Case #" + CASE + ": "+erg);
			erg=0;
		}
		
		lin.close();
		out.close();
	}

}
