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.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;


public class round1 {

	/**
	 * @param args
	 */
	
	
	
	
	static BufferedReader openRead(String fileName){
		 BufferedReader in = null;
		try {
			in = new BufferedReader(new FileReader(fileName));
		} catch (FileNotFoundException e) {
			System.err.println("Error Opening the input file");
			e.printStackTrace();
		}
		 return in;
	}
	
	
	static void processLine( String line ,  int k, PrintStream ps){
		ps.format("Case #%d: ", k);
		String[] lineItems = line.split(" ");
		int N = Integer.parseInt(lineItems[0]);
		int S = Integer.parseInt(lineItems[1]);
		int p = Integer.parseInt(lineItems[2]);
		int c = 3;
		int n = 0;
		for (int i = 0; i < N; i++){
			
			int pi = Integer.parseInt(lineItems[c++]);
			if (pi >= 3*p)
				n++;
			else if (pi >= 3*p -1)
				n++;
			else if (pi >= 3*p -2)
				n++;
			else if (pi >= 3*p - 4 && (3*p - 4)>=0 && S > 0){
				S--;
				n++;
			}
		}
	  ps.format("%d\n", n);	
		
	}
	
	public static void main(String[] args) throws IOException {
		if (args.length < 1){
			System.err.println("not suffucient args");
			System.exit(-1);
		}
		BufferedReader in = openRead(args[0]);
		PrintStream ps = new PrintStream(new File(args[1]));
		// read size
		int T = 0;
		String TStr = in.readLine();
		T = Integer.parseInt(TStr);
		if ( T < 1 || T > 100)
			System.exit(-1);
		
		
		// read contents
		String line;
		for (int i = 0; i < T  && (line = in.readLine())!= null; i++){
			processLine( line, i+1, ps);
		}
		
			
			
			
			
			
		System.out.println("Done!");

	}

}
