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.*;
public class DancingWithTheGooglers
{
	public static void main(String [] args) throws Exception
	{
		BufferedReader br = new BufferedReader(new FileReader("BBI.txt"));

		String write = "";
		int i = Integer.parseInt(br.readLine());

		for(int j = 1; j <= i; j++)
		{
			String ra = br.readLine();
			int c = 0;

			Integer [] ir = c(ra.split(" "));
			int S = ir[1];
			for(int k = 0; k < ir[0]; k++)
			{
				boolean flag = false;
				int score = ir[k + 3];
				int [] triplet = new int[3];
				
				for(int l = 0; l < 3; l++) 
				if(score >= 0)
				{
					triplet [l] = score / (3 - l);
					score = score - triplet[l];
					if(triplet[l] >= ir[2])
					{
						c = c + 1;
						flag = true;
						break;
					}
					
				}

				if(S > 0)
				{
					for(int m = 1; m < 3; m++)
					{
						if(!flag && triplet[m-1] > 0)
						if(triplet[m] == triplet[m - 1])
						{
							triplet[m] = triplet[m] + 1;
							triplet[m-1] = triplet[m-1] - 1;
							if(triplet[m] >= ir[2])
							{
								c = c + 1;
								S = S - 1;
							}
							break;
						}
					}

				}
				
			}

			String newLine = "\n";
			if(j == i)
				newLine = "";
			write = write + "Case #" + j + ": " + c + newLine;
			//System.out.println("Case #" + j + ": " + c);
		}

		BufferedWriter bw = new BufferedWriter(new FileWriter("BBO.txt"));
		bw.write(write);
		bw.flush();
		bw.close();
		System.out.println(write);
	}

	static Integer [] c(String [] args)
	{
		Integer [] array = new Integer[args.length];
		for(int i = 0; i < args.length; i++)
		{
			array [i] = Integer.parseInt(args[i]);
		}
		return array;
	}

}