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.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;


public class Dancing {
	 String inputFilePath = "C:\\Temp\\Google\\B-large.in";
	 String outputFilePath = "C:\\Temp\\Google\\output.txt";
	
	
	public static void main(String[] args)  throws NumberFormatException, IOException{

		new Dancing().go();
		
	}
	
	public void go() throws NumberFormatException, IOException{
		
		
		FileReader input = new FileReader(inputFilePath);
		BufferedReader reader = new BufferedReader(input);
		
	   int numTests = Integer.parseInt(reader.readLine());
		
		ArrayList<Integer> results = new ArrayList<Integer>();
		
		
		for (int i = 0; i < numTests; i++){
			String[] details = reader.readLine().split(" ");
			int numDancers = Integer.parseInt(details[0]);
			int numSurprise = Integer.parseInt(details[1]);
			int targetScore = Integer.parseInt(details[2]);
			Integer[] scores = new Integer[numDancers];
			for (int d = 0; d<numDancers; d++){
				scores[d] = Integer.parseInt(details[d+3]);
			}
			
			results.add(solve(numDancers, numSurprise, targetScore, scores));
			
		}
		
		 PrintWriter out = new PrintWriter(new FileOutputStream(outputFilePath));
		for (int i = 0; i<results.size(); i++){
			String line = "Case #" +(i+1) + ": " + results.get(i) + "\r\n";
			out.write(line);
		}
		out.flush();
			
		System.out.println("Done");
	}

	private Integer solve(int numDancers, int numSurprise, int targetScore, Integer[] scores) {
		// need to calculate the maximum number of dancers who could have gotten at least targetScore
		int nonSpecialThreshold = (3*targetScore) - 2;
		int specialThreshold = (3*targetScore) - 4;
		
		int numMeetingThreshold = 0;
		
		int numPossibleSpecial = 0;
		if (targetScore == 0){
			return numDancers;
		}
		for (int i = 0; i<scores.length; i++){
			if (scores[i] == 0){
				continue;
			}
			if (scores[i] >= nonSpecialThreshold){
				numMeetingThreshold++;
			} else if (scores[i] >= specialThreshold) {
				numPossibleSpecial++;
			}
		}
		
		return numMeetingThreshold + Math.min(numSurprise, numPossibleSpecial);
	}
}
