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.io.*;
import java.math.*;
import java.util.*;

public class CodeJam {

    void runCase(int caseNum) throws IOException {
        int n = nextInt();
        int s = nextInt();
        int p = nextInt();
        int ret = 0;
        Map<Integer, Boolean> nonSurprise = new HashMap<Integer, Boolean>();
        Map<Integer, Boolean> surprise = new HashMap<Integer, Boolean>();

        for (int i = 0; i <= 10; ++i) {
            for (int j = i; j <= Math.min(10, i + 2); ++j) {
                for (int k = Math.max(j, p); k <= Math.min(10, i + 2); ++k) {
                    int sum = i + j + k;
                    if (k - i == 2)
                        surprise.put(sum, true);
                    else
                        nonSurprise.put(sum, true);
                }
            }
        }

        for (int i = 0; i < n; ++i) {
            int t = nextInt();
            if (nonSurprise.containsKey(t)) {
                ++ret;
            } else if (s > 0 && surprise.containsKey(t)){
                ++ret;
                --s;
            }
        }

        System.out.print(new StringBuilder().append("Case #").append(caseNum).append(": ").append(ret).toString());

        System.out.println();
    }


    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(new File(
                "input.txt")));
        PrintStream ps = new PrintStream(new File(
                "output.txt"));
        System.setOut(ps);
        new CodeJam().runit();
        ps.flush();
        ps.close();
        return;
    }

    BufferedReader in;
    private StringTokenizer st;
    PrintWriter out;

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }



    void runit() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        st = new StringTokenizer("");

        int N = nextInt();
        for (int i = 0; i < N; i++) {
            runCase(i + 1);
        }

        out.flush();
    }

}
