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.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.TreeMap;


public class DancingWithGooglers {

	public static int isPossible(int score, int pointUnderConsideration, 
					      int surprisingTriplets)
	{
		int twoScore = score - pointUnderConsideration;
		
		if (twoScore < 0) {
			return 0;
		}
		
		// pt_under_con = 4; total score = 24; 8 8 8; 24 - 4 >= 2*4;
		if (twoScore >= pointUnderConsideration * 2) {
			return 1;
		}
		
		// 8 7 7; pt under consideration is 8; 16 - 14 <= 2;
		if ((pointUnderConsideration * 2) - twoScore <= 2) {
			return 1;
		}
		
		if ((pointUnderConsideration * 2) - twoScore  > 2 && 
		    (pointUnderConsideration * 2) - twoScore  <=4 &&
			 surprisingTriplets > 0)
		{
			return 2;
		}
		return 0;
	}
	
	public static int parseTestCase(String line)
	{
		String [] splitLine = line.split(" ");
		
		int numGooglers = Integer.parseInt(splitLine[0]);
		int surprisingTriplets = Integer.parseInt(splitLine[1]);
		int minPt = Integer.parseInt(splitLine[2]);
		
		int toRet = 0;
		
		for (int i = 0 + 3; i < numGooglers + 3; i++) {
			int score = Integer.parseInt(splitLine[i]);
			
			int retValOfFun = DancingWithGooglers.isPossible(score, minPt, surprisingTriplets);
			if (retValOfFun > 0) {
				toRet++;
			}
			if (retValOfFun == 2) {
				surprisingTriplets--;
			} 			
		}
		return toRet;	
	}
	
	public static void main(String [] args) throws IOException
	{
//		System.out.println(DancingWithGooglers.parseTestCase("2 1 1 8 0"));
		
		DataInputStream in = new DataInputStream(System.in);
		
		 
		System.out.println("Enter the input file name : ");
		String fileName = in.readLine();
		
		BufferedReader br = new BufferedReader(new FileReader(fileName));
		
		BufferedWriter bw = new BufferedWriter(new FileWriter("c:/gcj/myOp2.txt"));
		
		int numCases = Integer.parseInt(br.readLine());
		
		
		for (int i = 0; i < numCases; i++) {
			String line = br.readLine();
			bw.write("Case #" + (i+1) + ": " + DancingWithGooglers.parseTestCase(line) + "\n");
		}
		bw.close();
		br.close();
	}
}
 