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

import java.io.BufferedReader;
import java.io.FileReader;

import java.util.ArrayList;
import java.util.List;

public class ProblemB {
    
    public static void main(String args[]){
      List<String> inputs = readInput();
      int googlers = 0;
      int specialCases = 0;
      int bestScore = 0;
      List<Integer> googlerScores = new ArrayList<Integer>();
      int count = 0;
      for(String input : inputs){
          googlerScores = new ArrayList<Integer>();
          count++;
        String[] inputArray = input.split(" ");
          googlers = Integer.parseInt(inputArray[0]);
          specialCases = Integer.parseInt(inputArray[1]);
          bestScore = Integer.parseInt(inputArray[2]);
          
          for(int i=3; i<(3+googlers); i++){
            googlerScores.add(Integer.parseInt(inputArray[i]));
          }
          
          output(count, bestResult(googlerScores, specialCases, bestScore));
          
      }
    }
    

    private static int bestResult(List<Integer> googlerScores, int specialCases, int bestScore){
        int bestResults = 0;
        int scoreMinusMax  = 0;
        int avgScore = 0;
        for(Integer googlerScore : googlerScores){
            scoreMinusMax = googlerScore - bestScore;
            avgScore = scoreMinusMax / 2;
            
//            System.out.println("AVG SCORE: " + avgScore);
//            System.out.println("BEST SCORE: " + bestScore);
//            System.out.println("SPECIAL CASES: " + specialCases);
            if(googlerScore == 0 && bestScore > 0)
                continue;
            if(avgScore >= bestScore || (bestScore - avgScore) < 2){
              bestResults++;
            }else if((bestScore - avgScore) == 2 && specialCases > 0){                
                  specialCases--;
                  bestResults++;                
            }
        }
        
        
        return bestResults;
    }
    
  private static List<String> readInput(){
    List<String> untranslatedStrings = new ArrayList<String>();
    try{
        BufferedReader in = new BufferedReader(new FileReader("input.txt"));
        Long numTestCases = Long.parseLong(in.readLine());
        for(int i=0; i<numTestCases.intValue(); i++){
            untranslatedStrings.add(in.readLine());
        }          
    }catch(Exception e){
      e.printStackTrace();
    }
    
    return untranslatedStrings;
  }
  
  private static void output(int input, int bestResults){
    System.out.println("Case #"+input+": "+bestResults);
  }
}
