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.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++)
				for (int b = 0; b <= 10 && a + b <= sum[i]; b++)
					for (int c = 0; c <= 10 && c + a + b <= sum[i]; c++) {
						if (abs(a - b) <= 2 && abs(a - c) <= 2
								&& abs(b - c) <= 2) {
							int cool = 0;
							int awesome = 0;
							if (abs(a - b) == 2 || abs(b - c) == 2
									|| abs(a - c) == 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();
	}
}
