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.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;


public class googler 
{

	int cases;
	int googlers;
	int surprises;
	int goal;
	int[] points;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		googler gag = new googler();

	}
	
	public googler()
	{
		parseInput();
	}
	
	//read in each case line by line.
	public void parseInput()
	{
		try
		{
			FileInputStream fstream = new FileInputStream("B-small-attempt4.in");
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			FileWriter fwstream = new FileWriter("Googlers.out");
			BufferedWriter out = new BufferedWriter(fwstream);
			
			
			cases = Integer.parseInt(br.readLine());
			
			for (int i = 0; i < cases; i++)
			{
				solveCase(br.readLine(), i, out);
			}
			
			out.close();
			  
		}
		catch (Exception e)
		{//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}
	
	//parses variables for this case.
	public void solveCase(String caseArgs, int caseNum, BufferedWriter file) throws IOException
	{
		int y = 0; //the number of scores in this case above goal
		Scanner sc = new Scanner(caseArgs);
		googlers = sc.nextInt();
		surprises = sc.nextInt();
		goal = sc.nextInt();
		points = new int[googlers];
		int bestScore;
		// building the arrray of scores
		for (int i = 0; i < points.length; i++)
			points[i] = sc.nextInt();
				
		
		//System.out.println("N:" + googlers + " S:" + surprises + " P:" + goal + " " + Arrays.toString(points));
		for (int i = 0; i < points.length; i++)
		{

			if (unsurprising(points[i]))
			{
				y++; //chalk one up
				
			}
			else if (surprises > 0 && surprising(points[i]))
			{
				y++;
				surprises--;
			}
		}
		
		file.write("Case #" + (caseNum+1) + ": " + y + '\n');
		//System.out.println(" Case #" + (caseNum+1) + ": " + y);
	}
	
	
	//returns best score if unsurprising
	public boolean unsurprising(int total)
	{
		//System.out.println(goal);
		int min = goal*3;
		min = min - 2;
		if (min <= 0)
			min = goal;
		//System.out.println("min: " + min + " total: " + total);
		return (total >= min);
	}
	
	public boolean surprising(int total)
	{
		int min = goal*3;
		min = min - 4;
		if (min <= 0)
			min = goal;
		//System.out.println("Smin: " + min + " Stotal: " + total);
		return (total >= min);
	}
	
	
	

}
