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.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {
	static int[][] dp;
	static int[] sum;
	static int p;

	public static int abs(int a) {
		return (a < 0) ? -a : a;
	}

	public static int go(int i, int j) {
		if (j < 0)
			return -1000;
		if (i == sum.length) {
			if (j != 0)
				return -1000;
			else
				return 0;
		}

		else if (dp[i][j] != -1)
			return dp[i][j];
		else {
			int max = 0;
			for (int a = 0; a <= 10 && a <= sum[i]; a++)
				for (int b = a; b <= a + 2 && b <= 10 && a + b <= sum[i]; b++)
					for (int c = a; c <= a + 2 && c <= 10
							&& a + b + c <= sum[i]; c++) {
						if (a + b + c == sum[i]) {
							int cool = 0;
							int awesome = 0;
							if (b - a == 2 || c - a == 2)
								cool = 1;
							if (a >= p || b >= p || c >= p)
								awesome = 1;
							max = Math.max(max, awesome + go(i + 1, j - cool));
						}
					}
			return dp[i][j] = max;
		}
	}

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream("B.in")));
		PrintWriter out = new PrintWriter("B.out");
		int tc = Integer.parseInt(in.readLine());
		for (int cc = 1; cc <= tc; cc++) {
			StringTokenizer strtok = new StringTokenizer(in.readLine(), " ");
			int n = Integer.parseInt(strtok.nextToken());
			int s = Integer.parseInt(strtok.nextToken());
			p = Integer.parseInt(strtok.nextToken());
			dp = new int[n][s + 1];
			for (int[] a : dp)
				Arrays.fill(a, -1);
			sum = new int[n];
			for (int i = 0; i < n; i++)
				sum[i] = Integer.parseInt(strtok.nextToken());
			out.printf("Case #%d: %d\n", cc, go(0, s));
		}
		out.close();
		in.close();
	}
}
