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.util.Scanner;
class Another{
	private int total, modulo;
	public Another(int a){
		total = a;
		modulo = a % 3;
	}
	public int surprisingScore(){
		if (total < 3){
			return total;
		} else
		if (modulo == 2){
			return (total/3) + 2;
		} else {
			return (total/3) + 1;
		}
	}
	public int notSurprisingScore(){
		if (total < 2){
			return total;
		} else if (total == 2){
			return 1;
		} else
		if (modulo == 0){
			return (total/3);
		} else {
			return (total/3) + 1;
		}
	}
}
class DanceResult{
	private int[] myArray;
	private int arraySize, minimum, numberOfSurprises;
	private int[][] result;
	public DanceResult(int[] anArray, int min, int surprises){
		myArray = anArray;
		minimum = min;
		numberOfSurprises = surprises;
		arraySize = myArray.length;
		result = new int[arraySize][2];
	}
	public void generateScores(){
		for (int i = 0; i < arraySize; i++){
			int value = myArray[i];
			Another checkScore = new Another(value);
			int surprising = checkScore.surprisingScore();
			int notSurprising = checkScore.notSurprisingScore();
			result[i][0] = surprising;
			result[i][1] = notSurprising;
		}
		return;
	}
	public int solve(){
		int countSurprise = 0;
		int countNotSurprise = 0;
		for (int i = 0; i < arraySize; i++){
			if (result[i][0] >= minimum){
				countSurprise++;
			}
			if (result[i][1] >= minimum){
				countNotSurprise++;
			}
		}
		int difference = countSurprise - countNotSurprise;
		if (difference >= numberOfSurprises){
			return countNotSurprise + numberOfSurprises;
		} else
			return countSurprise;
	}
}
public class Dance {

	public static void main(String[] args) {
		int numberOfGooglers, numberOfSurprising, leastScore, numberOfCases, currentCase;
		int[] scores;
		DanceResult myResult;
		Scanner myScanner = new Scanner(System.in);
		numberOfCases = myScanner.nextInt();
		currentCase = 1;
		for (int j = 0; j < numberOfCases; j++){
			numberOfGooglers = myScanner.nextInt();
			numberOfSurprising = myScanner.nextInt();
			leastScore = myScanner.nextInt();
			scores = new int[numberOfGooglers];
			for(int i = 0; i < numberOfGooglers; i++){
				scores[i] = myScanner.nextInt();
			}
			myResult = new DanceResult(scores, leastScore, numberOfSurprising);
			myResult.generateScores();
			System.out.println("Case #" + currentCase + ": " + myResult.solve());
			currentCase++;
		}

		
	}

}
