import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;


public class B {
	static int[][] memo;
	static int[] nums;
	static int p;
	public static void main(String[] args)throws IOException
	{
		Scanner br=new Scanner(new File("B-small-attempt0.in"));
		PrintWriter out=new PrintWriter(new File("b.out"));
		int cases=br.nextInt();
		for(int c=1;c<=cases;c++)
		{
			int n=br.nextInt(),s=br.nextInt();
			p=br.nextInt();
			nums=new int[n];
			for(int i=0;i<n;i++)
				nums[i]=br.nextInt();
			memo=new int[n][s+1];
			for(int[] a:memo)
				Arrays.fill(a,-1);
			out.printf("Case #%d: %d\n",c,go(0,s));
		}
		out.close();
	}
	public static int go(int index,int s)
	{
		if(index>=nums.length)
			return 0;
		if(memo[index][s]!=-1)
			return memo[index][s];
		int best=0;
		for(int i=0;i<=10;i++)
		{
			int max=i;
			for(int j=0;j<=10;j++)
			{	
				if(Math.abs(i-j)>2)
					continue;
				max=Math.max(i,j);
				thisone:
				for(int k=0;k<=10;k++)
				{
					int ret=0;
					if(Math.abs(i-k)>2||Math.abs(j-k)>2)
						continue;
					max=Math.max(max,k);
					int count=0;
					if(Math.abs(i-k)==2)
						count++;
					if(Math.abs(i-j)==2)
						count++;
					if(Math.abs(j-k)==2)
						count++;
					if(i+j+k==nums[index])
					{
						boolean surp=(count>=1);
						if(surp&&s>0)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s-1);
						}
						else if(!surp)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s);
						}
						best=Math.max(best,ret);
					}
					else if(i+j+k>nums[index])
						break thisone;
				}
			}
		}
		return memo[index][s]=best;
	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {
	static BufferedReader br;
	static PrintWriter pw;
	static StringTokenizer st;
	static int k, ch, v = 0;
	static int t, n, s, p, tmp;
	static String str;
	static String[] stray = new String[110];
	static int[] intray = new int[100];

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) br.read();
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new FileReader("input.in"));
		pw = new PrintWriter("output.out");

		t = Integer.parseInt(br.readLine());

		for (int i = 1; i <= t; i++) {
			str = br.readLine();
			st = new StringTokenizer(str, " \t\n\r,.");
			while (st.hasMoreTokens()) {
				stray[k] = st.nextToken();
				k++;
			}

			n = Integer.parseInt(stray[0]);
			s = Integer.parseInt(stray[1]);
			p = Integer.parseInt(stray[2]);

			for (int j = 3; j < k; j++) {
				intray[j - 3] = Integer.parseInt(stray[j]);
			}

			for (int j = 0; j < n; j++) {
				if (intray[j] == 0) {
					if (p == 0) {
						continue;
					} else {
						ch++;
						continue;
					}
				}
				if (intray[j] % 3 == 0) {
					tmp = intray[j] / 3;
					if (tmp >= p) {
						continue;
					} else {
						if (p - tmp <= 1) {
							if (s != 0) {
								s--;
								continue;
							} else {
								ch++;
								continue;
							}
						} else {
							ch++;
							continue;
						}
					}
				} else {
					tmp = (int) (intray[j] / 3 + 0.5);
					if (intray[j] % 3 == 1) {
						if (tmp + 1 >= p) {
							continue;
						} else {
							ch++;
							continue;
						}
					} else {
						if (tmp + 1 >= p) {
							continue;
						}
						if (tmp + 2 >= p) {
							if (s != 0) {
								s--;
								continue;
							} else {
								ch++;
								continue;
							}
						} else {
							ch++;
							continue;
						}
					}
				}
			}

			v++;
			pw.println("Case #" + v + ": " + (n - ch));

			ch = 0;
			k = 0;
		}

		br.close();
		pw.close();
	}
}