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


package example2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class dance {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int nocases = Integer.parseInt(br.readLine());
        int arr[];
        int ans[] = new int[nocases];
        for (int i = 0; i < nocases; i++) {
            String token[] = br.readLine().split(" ");
            int N = Integer.parseInt(token[0]);
            int S = Integer.parseInt(token[1]);
            int P = Integer.parseInt(token[2]);
            arr=new int[N];
            for (int j = 0; j < N; j++) {
                arr[j] = Integer.parseInt(token[j + 3]);
            }
            ans[i]=method(arr, N, P, S);
        }
        for (int i = 0; i < nocases; i++) {
            System.out.println("Case #" + (i + 1) + ": " + ans[i]);
        }
    }
    private static int method(int[] arr, int N, int P, int S) {
        int c1 = 0, c2 = 0;
        for (int j = 0; j < N; j++) {
            if (arr[j] >= P) {
                int diff = (int) (arr[j] - P);
                if (((2 * P) - diff) <= 2) {
                    c1++;
                } else if ((((2 * P) - diff) <= 4) && (((2 * P) - diff) > 2)) {
                    c2++;
                }
            }
        }
        if (c2 > S) {
            c1 = c1 + S;
        } else {
            c1 = c1 + c2;
        }
        return c1;
    }
}
