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.*;
import java.util.*;
import java.awt.Point;
import java.lang.Math;

class Case{
	int num0,num1,num2,num3;
	String result="";
	public Case(File aFile) {

		try{
			StringBuilder contents = new StringBuilder();
		  	BufferedReader input =  new BufferedReader(new FileReader(aFile));
			String line = input.readLine();
			num0 = Integer.valueOf(line).intValue();
			int i=1;
			while (i<=num0 && ( line = input.readLine()) != null){

				StringTokenizer st = new StringTokenizer(line," ");
				num1=Integer.valueOf(st.nextToken()).intValue();
				num2=Integer.valueOf(st.nextToken()).intValue();
				num3=Integer.valueOf(st.nextToken()).intValue();

				Vector v1=new Vector();
				for (int j=0; j<num1; j++){
					int inum1=Integer.valueOf(st.nextToken()).intValue();
					v1.addElement(inum1);
				}

				oneCase(i,num1,num2,num3,v1);

			  	i++;
			}

		}
		catch (IOException ex){
		  ex.printStackTrace();
		}
	}

  public String getResult (){
	return result;
  }


  public void oneCase (int c,int n1,int n2,int n3,Vector vv){
	String re="";

	int noSurpriseScore=Math.max(0,n3*3-2);
	int needSurpriseScore=Math.max(0,n3*3-4);
	if (n3==1){
		needSurpriseScore=1;
	}
	int re_y=0;
	for (int i=0; i<vv.size(); i++){
		int score=((Integer)(vv.elementAt(i))).intValue();
		if (score>=noSurpriseScore){
			re_y++;
		} else if (n2>0 && score>=needSurpriseScore){
			re_y++;
			n2--;
		}
	}


//*** output
	System.out.println(" ");
	System.out.println("case="+c+": "+n1+":"+n2+":"+n3+" "+vv);
//***
	re=re_y+"";
	result+="Case #"+c+": "+re+System.getProperty("line.separator");
  }










}

public class ReadWriteTextFile {
  static public String getContents(File aFile) {
    StringBuilder contents = new StringBuilder();
    try {
      BufferedReader input =  new BufferedReader(new FileReader(aFile));
      try {
        String line = null;
        while (( line = input.readLine()) != null){
          contents.append(line);
          contents.append(System.getProperty("line.separator"));
        }
      }
      finally {
        input.close();
      }
    }
    catch (IOException ex){
      ex.printStackTrace();
    }
    return contents.toString();
  }
  static public void setContents(File aFile, String aContents)
                                 throws FileNotFoundException, IOException {
    if (aFile == null) {
      throw new IllegalArgumentException("File should not be null.");
    }
    if (!aFile.exists()) {
      throw new FileNotFoundException ("File does not exist: " + aFile);
    }
    if (!aFile.isFile()) {
      throw new IllegalArgumentException("Should not be a directory: " + aFile);
    }
    if (!aFile.canWrite()) {
      throw new IllegalArgumentException("File cannot be written: " + aFile);
    }
    Writer output = new BufferedWriter(new FileWriter(aFile));
    try {
      output.write( aContents );
    }
    finally {
      output.close();
    }
  }
  public static void main (String... aArguments) throws IOException {
    File testFile = new File("D:\\java\\readwritetext\\Dancing With the Googlers\\source.txt");
    File testFile2 = new File("D:\\java\\readwritetext\\Dancing With the Googlers\\result.txt");
	Case allcases = new Case(testFile);
    setContents(testFile2, allcases.getResult());
  }
}



















