package problem1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;





public class Problem1 {

    public static void main(String[] args) throws FileNotFoundException, IOException{
        try {
             TextIO.readFile("L:\\Coodejam\\Input\\Input.txt");
        }
        catch (IllegalArgumentException e) {
              System.out.println("Can't open file ");
              System.exit(0);
         }
        
        FileOutputStream fout = new FileOutputStream("L:\\Coodejam\\Output\\output.txt");
        PrintStream ps=new PrintStream(fout);
        
        int cases=TextIO.getInt();
        int googlers=0,surprising=0,least=0;
        for(int i=0;i<cases;i++){
            int counter=0;
            googlers=TextIO.getInt();
            surprising=TextIO.getInt();
            least=TextIO.getInt();
            int score[]=new int[googlers];
            for(int j=0;j<googlers;j++){
                score[j]=TextIO.getInt();
                 }
            
            
            
            
            Arrays.sort(score);
            int temp=0;
            int sup[]=new int[surprising];
            
          for(int j=0;j<googlers && surprising>0;j++){
               if(biggestNS(score[j])<least && biggestS(score[j])==least){
                   surprising--;
                   counter++;
                }
               }
           
            for(int j=0;j<googlers;j++){
                if(surprising==0)temp=biggestNS(score[j]);
                    
                else {
                    temp=biggestS(score[j]);
                    surprising--;     
                } 
                   if(temp>=least)counter++;
           
             }
            
             ps.println("Case #"+(i+1)+": "+counter);
        }
    }
    
   static int biggestNS(int x){
       if(x==0)return 0;
       if(x==1)return 1;
       return ((x-1)/3)+1;
   }
   
   static int biggestS(int x){
       if(x==0)return 0;
       if(x==1)return 1;
       return ((x-2)/3)+2;
   }
}
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class P02 {

	public static void main(String[] args) {
		init();
		Scanner inp = new Scanner(System.in);
		int t = inp.nextInt();
		inp.nextLine();
		int i = 1;
		while (t > 0) {
			int n = inp.nextInt();
			int s = inp.nextInt();
			int p = inp.nextInt();
			int ret = 0;
			for (int j = 0; j < n; j++) {
				int x = inp.nextInt();
				int v = x / 3;
				int mo = x % 3;
				if (v >= p)
					ret++;
				else if (mo > 0 && (v + 1) >= p)
					ret++;
				else if (s > 0 && (v + 2) >= p && mo == 2) {
					s--;
					ret++;
				} else if (s > 0 && (v + 1) >= p && (mo == 1 || v > 0)) {
					s--;
					ret++;
				}
			}

			System.out.println("Case #" + i + ": " + ret);

			--t;
			++i;
		}

	}

	static String[] coded = { "ejp mysljylc kd kxveddknmc re jsicpdrysi",
			"rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd",
			"de kr kd eoya kw aej tysr re ujdr lkgc jvqz" };
	static String[] uncoded = { "our language is impossible to understand",
			"there are twenty six factorial possibilities",
			"so it is okay if you want to just give upzq" };

	static Map<Character, Character> mapping = new HashMap<Character, Character>();

	private static void init() {
		for (int i = 0; i < coded.length; i++) {
			for (int j = 0; j < coded[i].length(); j++) {
				mapping.put(coded[i].charAt(j), uncoded[i].charAt(j));
			}
		}
	}

	private static String translate(String line) {
		String ret = "";
		for (int i = 0; i < line.length(); i++) {
			if (mapping.containsKey(line.charAt(i))) {
				ret = ret + mapping.get(line.charAt(i));
			} else if (line.charAt(i) == ' ') {
				ret = ret + line.charAt(i);
			} else {
				System.out.println("NOT " + line.charAt(i));
			}
		}
		return ret;

	}
}
