/**
 * 
 */
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.io.File;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class B {
  static int[] arr = new int[32];
  
  public static void main(String[] args) throws Exception {
    Scanner s = new Scanner(new File("B.in"));
    PrintWriter out = new PrintWriter(new File("B.out"));
    
    int T = s.nextInt();
    for (int tc = 1; tc <= T; tc++) {
      out.print("Case #" + tc + ": ");
      int N = s.nextInt();
      int S = s.nextInt();
      int p = s.nextInt();
      
      Arrays.fill(arr, 0);
      for (int i = 0; i < N; i++) arr[s.nextInt()]++;
      int ans = 0;
      for (int i = Math.max(3 * p - 2, 0); i <= 30; i++) ans += arr[i];
      int potential = 0;
      if (3 * p - 4 >= 2) potential += arr[3 * p - 4];
      if (3 * p - 3 >= 2) potential += arr[3 * p - 3];
      System.out.println(potential);
      ans += Math.min(potential, S);
      out.println(ans);
    }
    out.close();
  }
}
