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.*;
import java.util.*;

public class ProblemB {
	public static void main(String[] args) {
		/*
		try {
			System.setIn(new FileInputStream("b-example.in"));
		} catch (Exception e) {}
		*/
		new ProblemB();
	}
	
	public ProblemB() {
		Scanner input = new Scanner(System.in);
		int cases = input.nextInt();
		for (int n = 0; n < cases; n++) {
			int total = input.nextInt();
			int surprising = input.nextInt();
			int limit = input.nextInt();
			int[] score = new int[total];
			for (int i = 0; i < total; i++) {
				score[i] = input.nextInt();
			}
			int[][] triplet = new int[total][3];
			int[] tripletMax = new int[total];
			int[] tripletMin = new int[total];
			for (int i = 0; i < total; i++) {
				int tempScore = score[i];
				triplet[i][0] = tempScore / 3;
				tempScore -= triplet[i][0];
				triplet[i][1] = tempScore / 2;
				tempScore -= triplet[i][1];
				triplet[i][2] = tempScore;
				tripletMax[i] = Math.max(Math.max(triplet[i][0], triplet[i][1]), triplet[i][2]);
				tripletMin[i] = Math.min(Math.min(triplet[i][0], triplet[i][1]), triplet[i][2]);
			}
			int max = 0;
			int tempSurprising = surprising;
			List<Integer> secondPass = new ArrayList<Integer>();
			for (int i = 0; i < total; i++) {
				secondPass.add(i);
			}
			for (int i = 0; i < total; i++) {
				if (tripletMax[i] >= limit) {
					max++;
				} else if ((score[i] >= 2) && (tempSurprising > 0)) {
					if (tripletMax[i] >= (limit - 1)) {
						if ((tripletMax[i] - tripletMin[i]) == 1) {
							if ((tripletMax[i] == triplet[i][0] && tripletMax[i] == triplet[i][1] && tripletMin[i] == triplet[i][2]) ||
								(tripletMax[i] == triplet[i][0] && tripletMin[i] == triplet[i][1] && tripletMax[i] == triplet[i][2]) ||
								(tripletMin[i] == triplet[i][0] && tripletMax[i] == triplet[i][1] && tripletMax[i] == triplet[i][2])) {
								max++;
								tempSurprising--;
								secondPass.remove(secondPass.indexOf(i));
							}
						} else {
							if (triplet[i][0] == triplet[i][1] && triplet[i][1] == triplet[i][2]) {
								max++;
								tempSurprising--;
								secondPass.remove(secondPass.indexOf(i));
							}
						}
					}
				}
			}
			if (tempSurprising > 0) {
				for (int i : secondPass) {
					if (tempSurprising > 0) {
						if ((tripletMax[i] >= limit) || (score[i] >= 2)) {
							tempSurprising--;
						}
					}
				}
			}
			System.out.println("Case #" + (n+1) + ": " + max);
		}
	}
}
