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.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;


public class Solver {
	
	public static void main(String[] args) {
		try {
			FileInputStream fIS = new FileInputStream(args[0]);
			BufferedReader r = new BufferedReader(new InputStreamReader(fIS));
			
			int t = Integer.parseInt(r.readLine());
			for (int i=0;i<t;++i) {
				System.out.print("Case #" + (i+1) + ": ");
				if (i < t-1)
					System.out.println(solveTest(r.readLine()));
				else
					System.out.print(solveTest(r.readLine()));
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}			
	}

	private static int solveTest(String line) {
		String[] nums = line.split(" ");
		int n = Integer.parseInt(nums[0]);
		int s = Integer.parseInt(nums[1]);
		int p = Integer.parseInt(nums[2]);
		
		int[] scoresSums = new int[nums.length - 3];
		for (int i=3;i<nums.length;++i)
			scoresSums[i-3] = Integer.parseInt(nums[i]);
		
		int ok = 0;
		int okMin = notNegative(p-1) + notNegative(p-1) + p;
		
		for (int i=0;i<scoresSums.length;++i) {
			if (scoresSums[i] >= okMin)
				++ok;
		}
		
		int suprisings = 0;
		int sMin = notNegative(p-2)+notNegative(p-2)+p;
		for (int i=0;i<scoresSums.length;++i) {
			if (scoresSums[i] < okMin && scoresSums[i] >= sMin)
				++suprisings;
		}
		
		if (suprisings > s)
			suprisings = s;
		
		return ok + suprisings;
	}

	private static int notNegative(int i) {
		return (i < 0) ? 0 : i;
	}
}
