/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

import java.util.Scanner;

public class DancingWithTheGooglers {

   public static void main(String[] argv) {

      int lineCounter,numberOfLines,people,currentScore;
      int surprises,scoreToBeat,counter,answer;
      int possibleScore;
      Scanner input = null;

      try {input = new Scanner(System.in);}
      catch (Exception e) { System.err.println("FileNotFoundException: " + e.getMessage()); }

      numberOfLines = input.nextInt();

      for (lineCounter = 0; lineCounter < numberOfLines; lineCounter++) {
         answer = 0;
         input.nextLine();
         people = input.nextInt();
         surprises = input.nextInt();
         scoreToBeat = input.nextInt();

         for (counter = 0; counter < people; counter++) {
            currentScore = input.nextInt();
            possibleScore = scoreNoSurprise(currentScore);
            if (possibleScore >= scoreToBeat)
               answer++;
            else if (surprises > 0) {
               possibleScore = scoreSurprise(currentScore);
               if (possibleScore >= scoreToBeat) {
                  answer++;
                  surprises--;
               }
            }
         }

         System.out.printf("Case #%d: %d\n",lineCounter+1,answer);

      }

   }

   public static int scoreNoSurprise(int value) {
      if (value < 2)
         return value;
      if (value == 2)
         return 1;
      int totalScore = value;
      int divergence = totalScore%3;
      int baseScore = totalScore/3;
      if (divergence == 2) {
         return baseScore+1;
      }
      else if (divergence == 1) {
         return baseScore+1;
      }
      else { // divergence == 0
         return baseScore;
      }
   }

   public static int scoreSurprise(int value) {
      if (value < 3)
         return value;
      int totalScore = value;
      int divergence = totalScore%3;
      int baseScore = totalScore/3;
      if (divergence == 2) {
         return baseScore+2;
      }
      else if (divergence == 1) {
         return baseScore+1;         
      }
      else { // divergence == 0
         return baseScore+1;
      }
   }

}
