import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        B th = new B();
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            int[] t = new int[n];
            for (int j = 0; j < n; j++) {
                t[j] = sc.nextInt();
            }
            int c = th.getAnswer(s,p,t);
            System.out.println("Case #" + (i+1) + ": " + c);
        }
    }
    public int getAnswer(int s, int p, int[] t) {
        int A1 = p + p-1+p-1;
        int A2 = p + p-2+p-2;
        if (A1 < 0)
            A1 = 0;
        if (A2 < 0)
            A2 = 1;
        int remain = s;
        int count = 0;
        int n = t.length;
        for (int i = 0; i < n; i++) {
            if (t[i] >= A1) {
                count++;
            } else if (t[i] < A1 && t[i] >= A2) {
                if (remain > 0) {
                    remain--;
                    count++;
                }
            }
        }
        return count;
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;


public class Dancers
{
	public static void main(String[] args)
	{
		try
		{
			BufferedReader input = new BufferedReader(new FileReader("B-large.in"));
			BufferedWriter output = new BufferedWriter(new FileWriter("output.txt"));
			
			Integer numCases = Integer.parseInt(input.readLine());
			
			
			for(int i=0; i<numCases; ++i)
			{
				output.write("Case #"+(i+1)+": ");
				
				//output the number
				Scanner in= new Scanner(input.readLine());
				int N = in.nextInt();
				int S = in.nextInt();
				int P = in.nextInt();
				int[] scores = new int[N];
				for(int j=0; j<N; ++j) scores[j]=in.nextInt();
				Arrays.sort(scores);
				
				Integer n=0;
				for(int j=N-1; j>=0; --j)
				{
					if(bestScoreWithoutSuprise(scores[j])>=P)
						++n;
					else if(S!=0 && bestScoreWithSuprise(scores[j])>=P)
					{
						++n;
						--S;
					}
				}
				
				output.write(n.toString());
				
				if(i != numCases-1)
					output.write('\n');
			}
			
			input.close();
			output.close();
		} catch (NumberFormatException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static int bestScoreWithoutSuprise(int totalScore)
	{
		if(totalScore%3==0) return totalScore/3;
		else return totalScore/3 + 1;
	}
	
	public static int bestScoreWithSuprise(int totalScore)
	{
		if(totalScore == 0) return 0;
		else if(totalScore%3==0) return totalScore/3 + 1;
		else if(totalScore%3==1) return totalScore/3 + 1;
		else return totalScore/3 + 2;
	}
}
