import java.util.*;
public class Test {
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int T = in.nextInt();

    for(int i = 1; i<=T; i++) {
      int n = in.nextInt();
      int s = in.nextInt();
      int p = in.nextInt();
      int result = 0;
      for(int j = 0; j<n; j++){
        int x = canAddUp(in.nextInt(), p);
        if(x == 0) {
          result++;
        } else if (x==1 && s > 0) {
          result++;
          s--;
        }
      }
      System.out.println("Case #"+i+": "+result);
    }
  }

  public static int canAddUp(int sum, int limit) {
    boolean flag = false;
    for(int i = 0; i<=sum; i++) {
      for(int j = 0; i+j <= sum; j++) {
        int k = sum-(i+j);
        int a = Math.abs(i-j);
        int b = Math.abs(i-k);
        int c = Math.abs(j-k);
        if(a > 2 || b > 2 || c> 2){
          continue;
        }

        if (i>=limit || j>=limit || k>=limit) {
          if(a < 2 && b < 2 && c < 2) {
            return 0;
          }else{
            flag = true;
          }
        }
      }
    }
    return (flag) ? 1 : 2;
  }
}

import java.io.*;

/**
 * Created by IntelliJ IDEA.
 * User: YC14RP1
 * Date: 4/14/12
 * Time: 12:29 AM
 * To change this template use File | Settings | File Templates.
 */
public class Test2 {

    public static void main(String[] args) throws FileNotFoundException {
        String path = "C:\\Users\\YC14rp1\\Downloads\\B-large.in";
        try{
            // Open the file that is the first
            // command line parameter
            FileInputStream fstream = new FileInputStream(path);
            // Get the object of DataInputStream
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            //Read File Line By Line
            strLine = br.readLine();
            int n = Integer.valueOf(strLine);
            for (int i=1;i<=n;i++) {
                strLine = br.readLine();
                String[] split = strLine.split(" ");
                int k = Integer.valueOf(split[0]);
                int s = Integer.valueOf(split[1]);
                int m = Integer.valueOf(split[2]);
                int res = 0;
                int res2 = 0;
                for (int j=3;j<=2+k;j++) {
                    int score = Integer.valueOf(split[j]);
                    int c_m = score % 3;
                    if (score>3*m-3) {
                        res++;
                    } else {
                        if ((score-1>3*m-6) && (res2<s) && (m>=2)) {
                            //System.out.println(score-1);
                            //System.out.println(3*m-6);
                            res2++;
                        }
                    }
                }
                // Print the content on the console
                res = res + res2;
                System.out.println("Case #" + i + ": " + res);
            }
            //Close the input stream
            in.close();
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }

}
