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


public class Dance {

    private int[] mTotalScores;
    private int mMaxSurprise;
    private int mP;
    private int mAnswer;
    
    public Dance(int[] totalScores, int maxSurprise, int p) {
        mTotalScores = totalScores;
        mMaxSurprise = maxSurprise;
        mP = p;
        recurse(0, 0, 0);
    }
    
    public int getAnswer() {
        return mAnswer;
    }
    
    private void recurse(int index, int surprises, int qualified) {
        if (surprises > mMaxSurprise) return;
        if (index >= mTotalScores.length) {
            if (qualified > mAnswer) {
                mAnswer = qualified;
            }
            return;
        }
        
        Pair[] pos = scoreVariations(mTotalScores[index]);
        for (int i = 0; i < pos.length; i++) {
            int localSurprises = surprises;
            int localQualified = qualified;
            if (pos[i].surprise) localSurprises++;
            if (pos[i].max >= mP) localQualified++;
            recurse(index + 1, localSurprises, localQualified);
        }
    }
    
    // Get possible score variations
    public static Pair[] scoreVariations(int score) {
        HashSet<Pair> set = new HashSet<Pair>();
        
        int fStart = score / 3;
        int fEnd = Math.min(10, fStart + 3);
        
        for (int i = fStart; i <= fEnd; i++) {
            int sStart = i;
            int sEnd = Math.min(10, i + 2);
            for (int j = sStart; j <= sEnd; j++) {
                int k = score - i - j;
                
                if (Math.abs(i - k) > 2 || Math.abs(j - k) > 2 || k > 10 || k < 0) {
                    // Invalid case
                    continue;
                }
                
                boolean surprise = Math.abs(i - k) == 2 || Math.abs(j - k) == 2 || Math.abs(i - j) == 2;
                int max = Math.max(i, Math.max(j, k));
                set.add(new Pair(max, surprise));
            }
        }
        
        return set.toArray(new Pair[0]);
    }
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        
        for (int i = 0; i < num; i++) {
            int num2 = in.nextInt();
            int s = in.nextInt();
            int p = in.nextInt();
            int[] scores = new int[num2];
            for (int j = 0; j < num2; j++) {
                scores[j] = in.nextInt();
            }
            Dance d = new Dance(scores, s, p);
            System.out.println("Case #" + (i + 1) + ": " + d.getAnswer());
        }
    }

}
