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;
  }
}

public class Dancing {
    public static int atLeast;
    public static Googler[] googlers;

    public static void main(String[] args) {
        doProblems("100\n" +
                "6 2 8 29 20 8 18 18 21\n" +
                "70 70 7 20 6 28 3 3 27 25 22 18 24 20 2 17 9 27 27 28 2 8 4 10 26 28 3 9 24 28 8 18 3 23 14 23 16 27 13 23 16 10 8 26 22 21 4 11 13 19 11 15 4 28 26 3 25 24 16 28 20 5 11 18 2 25 14 22 22 28 26 15 10\n" +
                "54 54 9 20 24 25 26 26 10 23 8 15 23 26 14 4 6 25 22 20 4 6 8 8 23 4 6 9 13 24 12 2 11 19 14 10 27 12 23 17 2 10 11 14 22 8 11 25 8 15 22 14 26 10 6 17 20\n" +
                "47 0 6 22 9 11 19 19 29 11 0 3 27 27 11 28 5 20 25 22 18 8 20 10 9 29 1 5 15 27 25 19 12 3 11 26 5 26 28 6 15 12 25 20 0 18 21 2 4 29\n" +
                "90 32 6 6 20 24 24 17 30 18 0 12 18 21 21 13 21 21 11 8 30 21 13 17 29 16 6 25 14 14 24 21 5 7 22 18 7 9 27 17 9 19 22 24 22 28 27 7 9 17 7 10 29 3 24 5 22 18 27 7 29 20 28 5 29 11 20 0 6 8 0 19 6 24 5 14 21 24 7 0 8 25 10 4 30 15 18 17 16 27 15 30 1\n" +
                "97 6 10 26 1 26 20 19 14 27 16 21 2 10 27 28 3 2 9 28 22 16 28 28 25 4 20 7 5 9 26 0 3 21 17 23 26 29 9 21 18 24 13 10 23 3 15 12 10 20 1 30 2 30 29 28 11 17 29 19 21 2 12 21 24 10 30 13 12 9 30 29 24 12 1 11 9 14 15 29 14 8 3 21 6 9 12 6 12 7 22 19 14 30 22 8 27 16 16 10\n" +
                "4 0 10 26 9 27 26\n" +
                "64 8 4 19 18 8 9 1 16 8 5 9 9 4 9 8 8 24 8 8 26 9 8 9 8 9 8 9 9 9 10 8 9 9 21 8 0 9 9 13 24 9 16 2 4 9 8 20 8 9 8 8 19 22 28 8 9 9 8 8 9 26 20 15 12 9 8\n" +
                "17 3 6 8 14 21 7 17 22 22 9 12 19 22 4 2 16 19 20 7\n" +
                "55 11 8 5 0 19 28 20 20 30 21 20 14 5 21 20 20 19 5 18 2 20 5 20 20 27 21 5 21 5 11 27 3 28 6 20 21 21 7 21 21 20 20 20 20 18 20 9 20 21 24 20 22 13 21 14 21 23\n" +
                "67 0 8 11 2 12 8 10 26 2 4 19 28 1 1 27 28 25 5 8 17 15 20 30 12 8 23 29 19 13 15 12 26 1 28 22 5 23 19 13 18 14 24 28 1 22 11 26 16 18 17 17 13 20 11 6 8 12 19 19 8 16 18 12 20 9 21 29 20 29\n" +
                "87 87 5 8 13 3 28 28 16 22 22 22 11 17 8 14 23 3 6 3 16 17 24 28 24 9 13 12 13 18 17 15 2 3 9 15 18 11 13 10 13 19 8 10 24 8 20 28 5 22 8 12 17 2 19 14 28 20 11 9 18 2 24 28 25 18 19 24 4 26 18 12 25 3 17 16 7 19 4 22 15 16 14 16 19 19 21 20 2 19\n" +
                "80 0 10 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30\n" +
                "96 52 1 28 26 19 11 6 7 0 4 3 24 4 5 16 3 8 18 9 3 13 23 21 14 10 25 13 12 2 16 26 13 17 9 11 0 8 13 23 6 28 2 30 14 29 17 6 15 29 29 3 2 22 5 21 5 10 17 8 28 28 24 10 19 28 14 10 20 29 14 6 9 26 0 1 5 14 19 23 12 24 6 17 18 6 19 3 11 10 16 17 22 0 13 26 19 4 6\n" +
                "78 45 2 1 21 30 12 11 3 19 26 22 14 28 2 27 28 6 15 19 26 24 17 2 25 12 17 19 14 14 24 19 3 4 26 8 4 3 29 16 22 11 12 9 8 20 29 7 13 27 10 6 3 23 11 11 16 4 15 18 20 18 17 7 9 11 30 1 28 11 28 28 17 24 17 10 23 0 18 16 11\n" +
                "93 0 2 9 17 6 20 0 19 26 26 18 22 8 2 20 26 6 24 13 11 8 22 0 24 2 12 19 6 6 29 18 14 14 1 8 25 17 23 7 6 1 28 9 12 24 9 27 13 9 15 6 1 13 12 6 25 25 13 18 0 19 25 9 27 24 15 1 26 0 4 28 3 8 2 10 18 6 18 29 23 30 30 22 25 7 20 2 11 10 14 9 1 5 21 2\n" +
                "35 35 0 15 23 2 11 20 15 4 28 24 18 5 7 4 19 9 18 6 17 2 21 21 18 9 19 20 11 17 17 7 6 24 25 7 4 5\n" +
                "54 4 4 9 4 3 8 8 18 12 17 25 5 8 19 9 8 8 24 7 8 9 8 29 26 2 8 14 9 9 30 2 4 1 21 8 8 21 28 4 8 5 23 8 27 9 3 8 11 27 8 9 9 9 25 9 2\n" +
                "81 0 7 21 0 10 4 29 5 27 11 20 19 10 1 21 13 13 12 10 3 26 14 20 16 19 14 16 11 20 8 1 17 27 22 3 29 17 28 1 21 7 26 1 28 28 17 23 0 16 21 24 12 27 0 9 28 3 24 26 17 1 14 17 15 8 30 20 13 19 2 3 4 3 7 7 10 9 22 5 6 25 17 9\n" +
                "78 2 3 6 27 5 28 27 20 16 9 16 13 5 10 2 26 2 24 27 19 24 23 29 12 1 29 27 6 28 0 28 18 4 30 23 26 28 25 19 15 7 7 24 30 27 2 2 19 0 27 3 7 30 19 8 24 0 19 29 20 24 11 24 30 20 18 27 6 4 10 9 16 25 20 17 28 25 10 17 25\n" +
                "30 7 9 7 17 10 22 24 24 24 25 24 28 24 19 24 23 12 23 23 12 24 23 6 23 19 24 23 7 24 11 15 5\n" +
                "2 0 6 15 3\n" +
                "81 10 3 5 29 6 6 6 20 3 21 16 10 6 11 7 6 6 5 6 6 18 5 6 6 5 6 1 5 21 25 8 6 11 18 17 5 30 6 6 13 6 6 5 6 29 15 5 5 6 14 7 5 28 24 28 30 15 27 0 7 26 5 5 19 21 6 5 15 6 6 5 5 5 17 25 9 6 29 14 21 18 17 27\n" +
                "69 55 6 10 20 12 8 27 5 11 15 17 30 7 14 6 20 6 27 3 6 15 17 10 8 26 1 3 9 6 27 30 0 16 8 30 19 26 25 25 27 23 20 15 8 11 21 16 24 10 22 23 29 22 0 26 6 3 16 4 11 5 7 4 14 30 0 12 4 29 21 30\n" +
                "10 0 7 18 11 25 5 20 18 18 18 18 25\n" +
                "61 60 1 22 22 12 21 13 2 11 6 6 14 12 11 7 16 0 7 26 26 26 28 15 3 20 28 11 5 22 21 15 27 22 13 18 21 21 25 25 8 5 10 5 25 26 13 4 15 20 18 28 18 10 20 5 16 14 7 18 13 14 13 2\n" +
                "20 0 8 3 29 15 15 19 15 21 9 28 25 7 24 3 3 5 22 26 22 3 16\n" +
                "62 22 6 11 7 1 15 16 29 8 26 21 4 16 0 7 24 9 8 1 25 10 3 4 30 30 9 4 3 1 30 0 14 16 6 3 1 0 27 4 10 29 22 7 30 1 2 20 9 5 9 10 9 29 8 30 28 8 12 9 22 4 24 24 6\n" +
                "16 2 9 23 24 24 24 2 17 4 18 5 22 23 23 24 5 24 4\n" +
                "73 25 4 9 8 8 11 9 14 9 8 30 9 9 10 15 8 25 8 1 8 7 9 11 8 8 24 8 4 9 8 20 8 9 17 27 8 2 27 2 8 9 29 26 8 24 21 7 8 8 9 8 9 8 15 9 18 8 8 22 27 14 1 3 9 15 9 8 30 6 8 12 12 23 26 8\n" +
                "42 21 10 22 30 14 9 10 6 15 24 24 23 5 0 25 17 28 4 28 3 3 4 19 8 29 8 27 16 23 4 13 17 3 30 18 14 1 15 16 30 3 18 19 19\n" +
                "33 19 9 0 10 7 24 7 30 27 22 7 9 2 28 0 19 2 9 25 14 4 28 11 13 2 2 20 9 28 22 13 21 30 16 30\n" +
                "73 31 9 24 28 15 7 8 26 22 11 0 23 28 7 24 23 23 24 24 3 23 23 6 23 24 23 23 23 11 24 23 9 23 23 2 23 15 23 24 23 24 23 29 23 9 23 23 24 23 23 24 24 29 14 8 1 18 18 30 24 23 23 24 24 23 0 23 23 10 24 4 23 24 13 23\n" +
                "84 67 10 16 30 10 11 8 15 11 24 8 24 30 30 22 5 12 3 26 20 19 12 4 3 11 0 13 25 25 27 7 12 16 7 8 26 27 24 14 24 15 27 16 30 4 19 29 28 13 18 20 9 4 21 21 19 13 30 0 30 1 23 18 17 2 13 10 16 28 16 22 23 0 4 14 16 4 10 17 23 17 29 26 20 28 0\n" +
                "30 16 8 17 1 18 12 30 21 11 25 28 3 2 4 29 0 11 5 3 7 30 28 8 19 4 0 0 4 13 4 28 14\n" +
                "1 0 1 27\n" +
                "81 25 9 24 23 23 4 24 8 13 3 30 8 24 14 26 23 24 25 23 24 24 23 23 17 24 20 10 23 4 23 24 23 19 12 14 10 23 23 24 24 20 15 23 5 30 24 24 23 24 24 30 24 23 18 23 26 7 5 14 24 23 24 24 14 24 10 24 24 23 2 24 23 24 23 16 17 24 20 7 23 23 23 25\n" +
                "82 36 2 18 28 3 30 3 3 2 2 22 0 18 30 3 3 2 2 2 4 3 3 11 17 23 22 3 3 3 2 2 3 3 3 3 3 2 21 23 3 5 2 3 27 28 7 11 14 3 2 2 2 13 2 3 3 3 3 2 17 2 14 22 3 3 28 2 2 3 3 3 3 2 0 3 24 1 3 3 21 3 25 13 11\n" +
                "100 90 5 29 4 26 12 11 26 12 29 9 9 4 1 12 10 11 6 24 15 16 19 17 25 13 28 17 2 23 25 14 13 0 23 15 25 27 21 16 4 29 7 11 25 17 24 14 20 2 4 10 17 4 24 9 15 13 17 26 19 1 9 16 21 26 8 24 7 13 26 22 8 28 29 22 4 12 14 4 10 5 17 7 20 27 24 22 18 19 16 22 25 14 9 12 29 28 24 29 7 14 27\n" +
                "98 1 10 27 25 4 29 24 27 26 27 27 22 26 27 16 27 27 0 26 26 7 9 11 27 26 27 18 10 27 27 27 27 27 26 26 26 16 26 10 2 26 25 26 28 27 27 21 10 14 26 27 5 26 15 26 26 22 17 26 5 8 27 16 14 27 19 27 26 8 26 11 30 10 6 26 26 26 12 28 8 23 26 2 18 26 24 26 28 16 2 30 26 26 20 25 27 26 27 1 30\n" +
                "1 0 2 3\n" +
                "81 0 0 27 10 4 17 2 15 17 23 10 24 1 22 6 1 28 15 11 0 17 12 9 13 23 26 9 27 17 5 19 26 20 7 9 30 6 4 7 26 17 28 3 1 25 25 5 9 28 4 11 3 26 14 11 22 16 26 4 9 2 2 24 26 28 7 30 29 10 20 19 1 10 0 18 2 7 3 10 3 24 10 12\n" +
                "79 58 9 9 6 2 1 6 21 30 15 12 9 14 14 27 29 1 30 9 4 21 23 20 19 9 3 10 23 27 7 15 12 30 26 1 5 8 8 7 11 30 20 12 6 5 28 18 15 30 23 7 24 14 25 24 1 6 2 15 0 6 21 8 21 15 23 15 3 7 17 30 24 19 17 15 3 10 14 16 6 15\n" +
                "38 8 6 30 5 15 9 15 23 10 15 24 15 17 15 9 15 1 15 15 1 8 15 1 14 14 18 28 14 22 15 15 14 14 10 14 15 28 14 6 14\n" +
                "57 26 0 5 22 14 23 8 15 29 26 15 29 19 20 4 5 27 4 0 10 26 11 12 25 12 28 8 0 6 30 19 4 16 29 25 4 9 20 18 16 28 7 24 8 12 10 22 5 12 18 30 4 7 25 23 23 28 17 7\n" +
                "98 6 8 20 21 14 21 21 20 20 22 26 20 21 20 21 20 21 21 16 0 9 18 20 20 17 21 8 20 6 20 26 16 22 21 20 21 2 8 24 15 20 19 20 0 19 20 27 21 21 20 3 20 20 8 20 22 20 20 21 27 21 7 21 28 21 21 19 21 14 20 27 2 2 26 20 20 5 21 28 11 21 20 25 20 20 25 8 23 21 20 6 6 21 30 5 18 23 2 20 21\n" +
                "62 24 7 18 25 17 17 30 22 17 17 17 17 21 18 2 30 11 1 17 30 0 17 3 9 17 17 17 18 28 28 24 17 17 13 11 18 18 18 17 18 13 2 16 28 18 2 23 13 24 18 18 23 20 17 19 17 20 25 26 17 6 16 17 17\n" +
                "30 4 8 28 16 18 26 5 30 24 20 15 11 13 23 16 28 26 24 16 21 3 18 1 23 9 12 25 5 18 22 5 20\n" +
                "67 3 2 3 2 23 3 10 3 3 25 10 14 9 2 30 14 21 3 28 3 3 18 3 2 22 26 14 2 24 2 28 3 2 3 2 17 3 2 3 30 30 25 11 2 2 0 2 1 2 3 8 3 26 2 7 0 2 28 2 2 3 3 13 19 2 2 2 24 2\n" +
                "56 0 3 10 25 2 11 6 24 12 13 23 21 4 2 25 23 13 10 12 15 7 11 6 2 7 11 11 21 27 0 2 20 21 4 13 21 7 30 4 20 5 16 18 16 4 18 7 16 0 14 20 18 7 7 8 12 30 27\n" +
                "60 7 3 20 24 10 18 24 26 22 1 26 15 4 3 13 23 26 1 7 21 12 21 30 6 15 9 29 6 22 1 19 6 25 8 9 7 0 26 19 23 0 8 3 24 23 15 6 22 10 23 22 19 0 13 28 26 11 14 21 11 9 29\n" +
                "49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
                "92 14 7 19 26 0 5 10 7 27 27 25 2 12 26 20 11 5 21 28 28 17 22 1 10 20 8 17 28 21 17 22 8 26 24 4 20 16 19 2 19 30 12 22 11 14 4 0 5 7 28 18 10 20 29 5 30 25 28 21 12 1 24 23 12 13 21 26 5 11 20 30 0 28 2 2 10 2 12 14 12 10 2 26 6 18 16 17 19 22 16 28 20 4 17\n" +
                "8 8 3 17 20 25 5 9 28 16 10\n" +
                "54 0 6 14 14 14 14 15 15 28 15 7 15 13 15 12 14 15 11 15 13 29 17 0 15 3 14 14 0 15 24 26 22 14 15 15 25 13 14 15 22 3 15 15 12 14 13 23 14 15 2 8 11 15 9 14 21\n" +
                "82 27 8 25 4 24 25 20 21 30 21 20 21 20 4 20 20 12 25 28 26 21 20 10 20 20 30 21 2 29 21 20 21 20 28 0 21 20 28 23 20 20 30 29 3 21 23 20 21 21 0 21 17 20 8 22 9 10 6 21 20 20 19 28 25 21 12 21 9 30 20 20 9 20 21 7 21 7 21 25 20 21 4 20 17\n" +
                "67 6 9 9 17 18 22 11 20 2 2 12 27 4 6 1 24 27 7 0 4 20 26 24 11 15 28 13 22 1 17 11 29 5 12 18 29 9 3 13 18 26 4 13 27 27 13 23 6 27 6 14 14 18 6 5 12 6 22 2 22 30 9 20 17 24 29 15 0 25\n" +
                "51 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
                "74 0 2 13 16 27 28 19 12 11 4 29 7 12 29 1 10 21 20 11 16 17 14 2 7 5 11 6 7 24 12 6 23 14 2 24 25 5 7 14 4 16 0 15 12 4 21 23 16 0 18 10 4 21 14 17 6 5 10 1 24 19 19 26 17 19 28 18 29 24 20 28 25 5 14 8 6\n" +
                "32 26 6 1 10 0 2 2 6 13 15 24 18 29 11 8 19 23 4 30 7 18 24 2 9 29 30 19 27 7 21 20 14 18 7\n" +
                "11 1 6 23 7 12 28 5 16 29 13 14 4 16\n" +
                "55 26 2 8 11 14 15 15 25 9 19 1 19 17 27 24 29 25 20 25 0 18 9 11 25 24 18 30 7 6 2 1 14 24 28 6 7 10 17 19 2 21 6 20 30 29 29 29 24 17 11 4 7 15 23 19 17 5\n" +
                "24 0 0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30\n" +
                "94 41 7 6 11 26 21 18 1 13 17 3 23 26 10 23 24 19 13 10 24 25 7 18 1 9 8 14 19 18 5 2 3 20 24 11 4 15 22 11 10 16 19 16 16 30 5 19 25 18 22 17 24 2 9 9 26 9 25 22 28 25 14 23 8 27 10 27 27 18 14 28 30 6 27 14 14 11 13 17 1 27 13 5 2 30 15 18 17 17 27 24 18 13 21 5 12\n" +
                "38 16 8 21 21 21 5 30 8 20 9 23 30 16 7 21 11 20 21 12 20 21 0 21 11 20 9 20 11 20 20 20 20 16 20 22 21 21 29 0 5\n" +
                "55 55 0 4 19 14 4 19 5 23 28 17 24 6 7 25 20 7 14 20 6 26 9 3 20 26 16 28 9 28 25 10 2 17 8 28 22 17 21 18 5 22 20 16 12 10 23 23 4 2 17 6 18 5 17 10 24 2\n" +
                "19 7 2 3 1 26 26 7 4 19 14 28 20 21 1 0 14 10 26 16 14 17\n" +
                "90 26 0 12 7 3 0 19 8 23 4 21 28 28 21 24 2 26 17 1 9 20 30 10 15 19 12 5 22 13 7 10 28 5 29 7 20 20 28 5 4 11 18 10 21 12 0 2 27 28 23 26 17 22 22 8 1 1 20 30 28 24 27 15 9 23 2 3 0 13 16 6 6 24 18 30 1 16 6 12 7 8 7 14 30 10 24 6 4 25 21 11 1\n" +
                "71 3 5 11 23 12 11 11 3 23 4 12 15 11 29 12 30 11 12 15 12 17 3 21 11 7 10 11 0 26 9 20 11 12 11 12 7 21 25 11 2 27 11 12 12 11 12 11 23 2 12 26 30 11 2 12 11 8 11 11 11 20 12 12 10 12 11 12 11 8 11 5 11 12\n" +
                "41 0 2 0 28 2 5 20 4 11 27 14 30 1 4 29 30 4 26 24 12 13 22 6 28 30 20 30 6 20 11 30 6 6 8 30 22 20 14 29 7 0 22 19\n" +
                "52 44 7 3 19 5 28 14 19 23 25 1 0 21 28 13 4 29 15 1 22 25 28 8 1 17 26 21 10 15 5 6 24 3 17 19 14 23 30 18 12 10 26 9 16 28 29 4 20 19 4 17 7 8 28\n" +
                "78 29 9 23 24 24 23 24 24 29 28 13 16 17 26 5 23 10 6 28 7 0 23 8 24 24 24 24 12 9 14 24 23 16 13 23 20 24 10 24 23 24 23 23 23 25 21 24 23 24 23 20 24 13 10 16 20 9 27 24 23 24 24 23 14 14 23 6 24 23 24 24 17 24 25 24 23 1 0 15 23\n" +
                "27 0 0 0 19 26 20 28 17 3 7 4 2 0 11 13 8 18 27 22 27 27 25 16 23 29 28 16 24 27\n" +
                "95 36 0 17 14 1 25 5 15 12 21 28 14 14 0 26 11 28 0 22 21 5 13 18 20 25 19 13 18 13 11 14 2 20 23 1 9 12 1 14 12 4 28 14 3 23 23 23 25 23 3 11 30 25 24 25 15 28 28 26 29 26 24 11 13 18 22 20 29 22 7 30 9 4 28 22 8 17 11 10 27 30 8 28 11 30 18 2 13 14 13 11 2 5 30 16 3 22\n" +
                "55 1 6 14 14 27 16 14 18 8 15 2 0 14 29 14 15 15 3 28 14 23 14 14 15 8 15 15 23 25 15 1 15 15 23 14 15 14 14 15 15 24 19 15 15 27 24 9 9 14 24 6 13 23 15 5 15 14\n" +
                "8 5 5 1 14 30 26 10 8 12 25\n" +
                "96 37 8 16 5 30 0 13 8 21 13 29 21 24 0 23 9 20 23 0 21 8 10 10 15 24 28 23 17 5 17 28 7 7 7 22 17 3 28 8 13 8 14 24 25 20 16 10 12 9 23 11 28 3 8 13 20 14 25 2 13 17 13 4 6 29 26 15 5 17 10 19 30 25 2 6 21 9 12 1 18 4 29 12 7 13 7 30 25 12 29 29 27 3 22 11 29 14 19\n" +
                "14 12 4 24 9 28 1 14 13 30 17 5 24 26 9 25 15\n" +
                "11 0 3 6 5 6 6 15 11 30 26 6 6 5\n" +
                "5 0 4 20 23 8 8 2\n" +
                "77 25 8 20 21 19 29 21 23 21 30 21 21 8 21 21 20 19 0 21 8 3 20 9 21 13 29 21 20 14 20 20 20 2 21 11 19 29 18 1 21 20 14 22 20 27 23 20 21 20 21 21 20 10 20 20 21 2 23 23 21 19 22 4 20 16 20 20 21 8 21 21 20 24 21 21 24 21 21 6\n" +
                "80 8 1 26 9 15 12 4 12 27 17 24 30 22 20 18 7 22 16 26 5 3 1 10 0 0 6 25 2 29 12 5 10 22 26 20 7 7 11 9 15 1 16 5 3 19 26 22 18 6 9 26 8 20 23 7 18 3 23 7 25 7 7 4 25 23 11 0 17 3 0 24 4 27 8 10 4 20 4 20 2 3 19\n" +
                "83 0 5 24 6 6 19 14 21 8 1 18 8 30 16 18 27 5 15 6 27 3 10 15 2 10 11 2 12 1 15 2 29 9 24 8 11 2 20 7 9 23 10 18 23 5 26 8 5 12 30 0 8 6 26 19 5 18 27 7 0 25 25 0 15 4 11 11 18 2 13 17 27 9 28 4 11 9 1 15 4 4 30 25 24 9\n" +
                "25 22 1 25 28 18 7 11 8 15 23 22 10 17 2 14 20 2 5 4 0 2 21 1 19 7 5 2\n" +
                "54 54 10 26 27 12 17 3 14 26 10 14 24 10 7 11 10 16 3 10 26 24 12 25 19 17 21 13 4 21 3 5 4 21 3 4 13 3 24 25 27 16 11 15 27 23 9 26 15 27 26 17 18 11 26 8 27\n" +
                "49 20 1 26 13 9 15 8 3 26 28 27 6 17 2 16 29 0 25 21 24 18 11 2 3 4 29 17 11 29 23 24 7 25 28 5 1 14 19 3 29 28 19 15 5 29 22 29 21 24 23 9\n" +
                "41 3 8 0 21 20 21 15 21 21 11 21 28 21 20 21 20 5 20 21 21 21 9 20 19 20 21 16 24 21 20 21 20 26 21 27 21 21 7 21 21 20 10 21\n" +
                "81 81 0 23 22 5 6 27 26 20 19 10 18 20 12 9 25 27 13 16 8 21 12 16 14 22 3 22 5 15 8 16 6 28 16 24 2 22 7 21 5 13 10 5 11 17 24 26 23 7 28 8 13 27 7 5 21 28 17 20 13 3 20 14 6 8 19 14 16 13 5 16 27 7 14 21 17 14 14 28 10 15 25 8\n" +
                "72 40 8 21 24 20 21 12 21 22 21 21 21 21 20 27 24 20 17 28 3 21 20 21 24 21 19 20 21 21 9 21 6 29 20 3 29 21 16 8 20 20 20 21 28 20 21 21 21 20 1 20 21 21 8 20 21 16 19 25 21 17 12 20 21 9 24 21 21 21 2 20 21 21 21\n" +
                "46 26 7 12 18 30 30 20 11 24 3 26 8 24 10 22 27 19 12 14 20 5 14 22 6 15 8 10 5 0 30 2 26 10 22 22 20 24 10 20 14 16 4 8 17 24 26 30 17\n" +
                "99 79 4 28 22 3 26 6 4 23 12 17 0 15 29 11 13 24 9 28 20 5 12 9 4 17 29 22 18 4 9 11 26 24 4 3 29 25 3 26 18 25 18 13 5 16 20 4 13 12 27 17 14 5 16 5 19 0 29 30 26 28 23 9 11 22 17 22 9 3 15 21 9 27 4 1 1 0 15 19 6 15 23 3 16 18 27 6 8 22 10 13 9 11 9 30 0 28 3 5 27 25\n" +
                "5 1 10 22 2 18 22 5\n" +
                "63 0 0 0 18 8 8 0 4 19 1 30 6 29 11 5 14 21 16 21 3 18 10 12 17 15 29 3 30 24 15 18 9 9 20 0 12 22 4 28 28 5 17 1 8 20 14 11 10 0 30 13 6 21 7 3 0 9 6 5 14 7 18 4 19 3\n" +
                "43 20 5 18 12 12 11 3 17 17 11 11 11 12 12 21 13 12 9 12 11 12 12 9 11 11 11 19 11 11 12 18 12 12 11 24 12 11 12 15 5 11 11 12 17 30\n" +
                "80 30 4 9 8 8 9 8 9 24 8 27 9 24 20 14 9 9 0 11 8 28 3 6 9 13 9 17 8 13 9 8 9 9 8 8 9 8 18 14 8 8 0 5 24 4 6 27 16 21 9 8 9 8 8 9 9 26 16 21 8 20 10 11 8 13 9 8 9 15 15 28 8 24 8 18 6 24 7 1 28 25 3\n" +
                "38 38 5 15 13 4 16 8 16 23 2 9 16 22 16 23 4 15 15 17 9 28 10 8 10 6 9 6 6 11 28 15 15 28 13 24 15 28 26 19 18\n" +
                "63 21 6 15 14 5 14 28 15 8 25 16 15 14 19 15 19 21 14 12 6 26 30 14 14 14 15 15 23 15 30 13 12 25 7 29 15 23 14 9 29 24 5 30 15 22 21 28 14 14 15 15 14 5 14 15 7 7 15 15 15 14 4 14 15 15\n" +
                "88 6 1 25 25 25 27 16 29 6 17 1 8 28 16 18 2 12 6 6 18 6 1 0 22 14 11 6 27 26 18 30 5 15 30 19 14 2 28 7 25 0 23 8 16 17 11 2 19 10 8 3 13 5 23 23 2 13 10 3 1 3 7 7 21 21 20 19 4 18 18 16 1 15 15 23 4 15 5 9 1 24 14 10 13 16 12 3 20 6 9\n" +
                "83 45 7 13 20 8 27 0 20 28 27 8 0 28 25 30 9 16 24 4 27 30 26 8 4 2 24 23 10 25 29 11 19 6 29 23 0 13 6 21 26 20 6 5 17 30 7 29 25 16 18 9 2 30 16 13 1 10 28 30 11 1 28 23 24 19 27 3 22 19 20 8 22 8 10 21 24 4 11 21 25 28 5 1 28 8\n" +
                "16 16 7 8 24 4 27 21 13 15 4 7 18 23 17 28 28 17 16\n");
    }

    private static void doProblems(String in) {
        String[] problems = in.split("\n");
        for (int count = 0; count < Integer.valueOf(problems[0]); count++) {
            doProblem(problems[count + 1], count + 1);
        }
    }

    private static void doProblem(String in, int problemNumber) {
        String[] array = in.split(" ");
        int numberOfGooglers = Integer.valueOf(array[0]);
        int surprisingGooglers = Integer.valueOf(array[1]);
        atLeast = Integer.valueOf(array[2]);
        int[] googlerTotals = new int[numberOfGooglers];
        for (int count = 0; count < numberOfGooglers; count++) {
            googlerTotals[count] = Integer.valueOf(array[count + 3]);
        }
        googlers = new Googler[numberOfGooglers];
        for (int count = 0; count < numberOfGooglers; count++) {
            googlers[count] = new Googler(googlerTotals[count]);
        }
        int finalOut = 0;
        for (int count = 0; count < googlers.length; count++) {
            if (googlers[count].canBeTotal) {

                if (!googlers[count].requiresStrange) {
                    finalOut++;
                } else if (surprisingGooglers > 0) {
                    finalOut++;
                    surprisingGooglers--;
                }


            }
        }
        System.out.println("Case #" + problemNumber + ": " + finalOut);

    }


    static class Googler {
        private int total;
        private boolean canBeTotal;
        private boolean requiresStrange;
        private boolean countMe;

        public Googler(int total) {
            this.total = total;
            canBeAtLeast();
            //System.out.println(total + " " + canBeTotal + " " + atLeast + " " + requiresStrange);
        }

        private void canBeAtLeast() {

            if (total % 3 == 0) {
                int eachSide = total / 3;
                if (eachSide >= atLeast) {
                    canBeTotal = true;

                } else if (eachSide + 1 >= atLeast) {
                    canBeTotal = true;
                    requiresStrange = true;
                }
            } else if (total % 3 == 1) {
                int doubleLong = (int) Math.ceil(total / 3f);
                if (doubleLong >= atLeast) {
                    canBeTotal = true;
                }
            } else if (total % 3 == 2) {
                int doubleLong = (int) Math.ceil(total / 3f);
                if (doubleLong >= atLeast) {
                    canBeTotal = true;
                } else if (total - doubleLong * 2 + 2 >= atLeast) {
                    canBeTotal = true;
                    requiresStrange = true;
                }
            }
            if (total < 2) {
                requiresStrange = false;
                if (total < atLeast) {
                    canBeTotal = false;
                }
            }
        }


    }

}
