import java.util.*;
import java.io.*;

public class DancingWithTheGooglers
{
    public DancingWithTheGooglers()
    {
        Scanner inFile = null;
        try
        {
            inFile = new Scanner(new File("inputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening input file. Exiting...");
			System.exit(0);
        }
        int t = inFile.nextInt();
        
        int [] results = new int [t];
        DancingWithTheGooglersMax [] rnc = new DancingWithTheGooglersMax[t];
        
        int i, j;
        int [] scores;
        int s, p;
        for(i = 0; i < t; i++)
        {
            scores = new int [inFile.nextInt()];
            s = inFile.nextInt();
            p = inFile.nextInt();
            for(j = 0; j < scores.length; j++)
                scores[j] = inFile.nextInt();
            
            rnc[i] = new DancingWithTheGooglersMax(i, scores, s, p, results);
            rnc[i].start();
        }
        inFile.close();
        
        boolean done = false;
        
        while(!done)
        {
            done = true;
            for(i = 0; i < t; i++)
                if(rnc[i].isAlive())
                {
                    done = false;
                    break;
                }
        }
        
        PrintWriter outFile = null;
        try
        {
            outFile = new PrintWriter(new File("outputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening output file. Exiting...");
			System.exit(0);
        }
        
        for(i = 0; i < results.length; i++)
            outFile.printf("Case #%d: %d\n", i+1, results[i]);
        outFile.close();
    }
    
    public static void main(String [] args)
    {
        new DancingWithTheGooglers();
    }
    
    private class DancingWithTheGooglersMax extends Thread
    {
        int id;
        int s, p;
        int [] results, scores;
        
        public DancingWithTheGooglersMax(int i, int [] aScores, int aS, int aP,int [] res)
        {
            id = i;
            s = aS;
            p = aP;
            results = res;
            scores = aScores;
        }
        
        public void run()
        {
            int a = 0, b = 0;
            
            if(p == 0)
                results[id] = scores.length;
            else if(p == 1)
            {
                int y;
                y = 3*p - 3;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > 0)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
            else
            {
                int y, z;
                y = 3*p - 3;
                z = 3*p - 5;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > z)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
        }
    }
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;

class GoogleDance{
	
	HashMap<Integer,Integer> nonSurpriseMax = new HashMap<Integer,Integer>();
	HashMap<Integer,Integer> surpriseMax = new HashMap<Integer,Integer>();
	
	GoogleDance(){
		nonSurpriseMax.put(0, 0);
		nonSurpriseMax.put(1, 1);
		nonSurpriseMax.put(2, 1);
		nonSurpriseMax.put(3, 1);
		nonSurpriseMax.put(4, 2);
		nonSurpriseMax.put(5, 2);
		nonSurpriseMax.put(6, 2);
		nonSurpriseMax.put(7, 3);
		nonSurpriseMax.put(8, 3);
		nonSurpriseMax.put(9, 3);
		nonSurpriseMax.put(10, 4);
		nonSurpriseMax.put(11, 4);
		nonSurpriseMax.put(12, 4);
		nonSurpriseMax.put(13, 5);
		nonSurpriseMax.put(14, 5);
		nonSurpriseMax.put(15, 5);
		nonSurpriseMax.put(16, 6);
		nonSurpriseMax.put(17, 6);
		nonSurpriseMax.put(18, 6);
		nonSurpriseMax.put(19, 7);
		nonSurpriseMax.put(20, 7);
		nonSurpriseMax.put(21, 7);
		nonSurpriseMax.put(22, 8);
		nonSurpriseMax.put(23, 8);
		nonSurpriseMax.put(24, 8);
		nonSurpriseMax.put(25, 9);
		nonSurpriseMax.put(26, 9);
		nonSurpriseMax.put(27, 9);
		nonSurpriseMax.put(28, 10);
		nonSurpriseMax.put(29, 10);
		nonSurpriseMax.put(30, 10);
		
		surpriseMax.put(0, 0);
		surpriseMax.put(1, 1);
		surpriseMax.put(2, 2);
		surpriseMax.put(3, 2);
		surpriseMax.put(4, 2);
		surpriseMax.put(5, 3);
		surpriseMax.put(6, 3);
		surpriseMax.put(7, 3);
		surpriseMax.put(8, 4);
		surpriseMax.put(9, 4);
		surpriseMax.put(10, 4);
		surpriseMax.put(11, 5);
		surpriseMax.put(12, 5);
		surpriseMax.put(13, 5);
		surpriseMax.put(14, 6);
		surpriseMax.put(15, 6);
		surpriseMax.put(16, 6);
		surpriseMax.put(17, 7);
		surpriseMax.put(18, 7);
		surpriseMax.put(19, 7);
		surpriseMax.put(20, 8);
		surpriseMax.put(21, 8);
		surpriseMax.put(22, 8);
		surpriseMax.put(23, 9);
		surpriseMax.put(24, 9);
		surpriseMax.put(25, 9);
		surpriseMax.put(26, 10);
		surpriseMax.put(27, 10);
		surpriseMax.put(28, 10);
		surpriseMax.put(29, 10);
		surpriseMax.put(30, 10);
	}
	
	
	int getcount(String input){
		int p = 0,surprises=0;
		
		int no_of_score =0;
		int count=0;
		StringTokenizer t =  new StringTokenizer(input);
		
		if(t.hasMoreTokens()){
			no_of_score = Integer.parseInt(t.nextToken());
		}
		if(t.hasMoreTokens()){
			surprises = Integer.parseInt(t.nextToken());
		}
		if(t.hasMoreTokens()){
			p = Integer.parseInt(t.nextToken());
		}
		while(t.hasMoreTokens()){
			
			int inputsum = 	Integer.parseInt(t.nextToken());
			
			if(nonSurpriseMax.get(inputsum) >= p)
				count++;
			else if(surpriseMax.get(inputsum) >= p && surprises >0 ){
				surprises--;
				count++;
			
			}
		}
		return count;
	}
	
	
	public static void main(String args[]){
		
	GoogleDance d = new GoogleDance();
	
	int no_of_cases = 0;
	String input = "";
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	try{
		no_of_cases = Integer.parseInt(br.readLine());
	}
	catch(Exception e){
		System.out.println("First line is not a number");
	}
	
	for(int i=1; i <= no_of_cases;i++){
		try{
			input = br.readLine();
		}
		catch(Exception e){
			System.out.println("Number of test cases different from the number mentioned in first line");
		}
		
		System.out.print("Case #" +i+": ");
		System.out.println(d.getcount(input));
		

		
	}
	
	
	}
}