/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

import java.io.*;
import java.util.*;


public class Solution {
	
	public static int calc(int N, int S, int p, int[] t){
		int ret = 0;
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for(int i=0; i<t.length; i++){
			if(Math.ceil((double)t[i]/3) >= p){
				ret ++;
			}
			// surprisingåè£
			else{
				list.add(new Integer(t[i]));
			}
		}
		
		// surprisingåè£ãéé ã«ã½ã¼ã
		Collections.sort(list, new Comparator<Integer>(){
		      public int compare(Integer t1, Integer t2) {
		          return t2 - t1;
		        }
		      });
		
		for(Integer ii : list){
			if(S>0){
				// surprisingã§+1æä½ã§ããæ¡ä»¶
				//   - åè¨å¤ã2ä»¥ä¸
				//   - åè¨å¤ãæ§æãã3ã¤ã®æ°å¤ã®ãã¡ã3ã¤ãåãæ° ã¾ãã¯ å¤§ããæ¹ã®2ã¤ãåãæ°
				if(ii.intValue() >= 2 && (ii.intValue()%3 != 1)){
					// åè¨å¤ã3ã§å²ã£ãå¤ãåãä¸ãã¦æå¤§å¤ã¨ãã
					if(Math.ceil((double)ii.intValue()/3) >= p-1){
						System.out.println("includes surprising " + ii.intValue() + "->" + (Math.ceil((double)ii.intValue()/3)+1) + "," + "other");
						ret ++;
						S --;
						if(S == 0){
							break;
						}
					}
				}
			}
		}
		
		return ret;
	}
	
	public static void main(String[] args){
        if(args.length == 0){
            System.exit(1);
        }

        try{
            FileReader fr = new FileReader(args[0]);
            BufferedReader br = new BufferedReader(fr);
            
            FileOutputStream fos = new FileOutputStream("output.out");
            OutputStreamWriter osw = new OutputStreamWriter(fos , "UTF-8");
            BufferedWriter bw = new BufferedWriter(osw);
            
            String tmp_str;
            
            tmp_str = br.readLine();
            
            int numOfCases = Integer.parseInt(tmp_str);
            int caseIndex = 0;

            while((tmp_str = br.readLine()) != null){
            	caseIndex++;

                StringTokenizer st = new StringTokenizer(tmp_str, " ");
                int numOfTokens = st.countTokens();
                String[] tokenOfLine = new String[numOfTokens];
                for(int i=0; i<numOfTokens; i++){
                	tokenOfLine[i] = st.nextToken();
                }
                
                int N = Integer.parseInt(tokenOfLine[0]);
                int S = Integer.parseInt(tokenOfLine[1]);
                int p = Integer.parseInt(tokenOfLine[2]);
                
                //System.out.println("N:" + N);
                //System.out.println("S:" + S);
                //System.out.println("p:" + p);
                
                int[] t = new int[N];
                for(int i=0; i<N; i++){
                	int j=i+3;
	                t[i] = Integer.parseInt(tokenOfLine[j]);
	                //System.out.println("t[" + i + "]:" + t[i]);
                }
                
                int ret = calc(N, S, p, t);
                
                System.out.println("Case #" + caseIndex + ": " + ret);
                
            	if(caseIndex==numOfCases){
                	bw.write("Case #" + caseIndex + ": " + ret);
            	}else{
                	bw.write("Case #" + caseIndex + ": " + ret + "\n");
            	}
            }
            br.close();
            bw.close();
            osw.close();
            fos.close();

 
        }
        catch(IOException e){
            e.printStackTrace();
            System.exit(1);
        }

	}
}
