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.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;

public class CodeJam2
{

    private class Data
    {
        private int num;
        private int surprise;
        private int threshold;
        private Integer[] values;

        public Data(int num, int surprise, int threshold, Integer[] values)
        {
            this.num = num;
            this.surprise = surprise;
            this.threshold = threshold;
            this.values = values;
        }

        public int getNum()
        {
            return num;
        }

        public int getSurprise()
        {
            return surprise;
        }

        public int getThreshold()
        {
            return threshold;
        }

        public Integer[] getValues()
        {
            return values;
        }

        public String toString()
        {
            return num + " " + surprise + " " + threshold + " " + values.length;
        }
    }

    private List<Data> getInputValue()
    {
        List<Data> inpVal = new ArrayList<Data>();

        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        try
        {
            final String tc_ = stdin.readLine();
            Integer testCase = Integer.parseInt(tc_);

            while (testCase-- > 0)
            {
                // System.err.println("tc#" + testCase);
                final String[] input = stdin.readLine().split(" ");
                int num = Integer.parseInt(input[0]);
                Integer[] values = new Integer[num];

                for (int i = 3; i < input.length; ++i)
                    values[i - 3] = Integer.parseInt(input[i]);

                Data data = new Data(num, Integer.parseInt(input[1]), Integer.parseInt(input[2]), values);

                inpVal.add(data);

            }

            return inpVal;
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        return null;
    }

    private static int getMaxWOSurprise(int a)
    {
        if (a % 3 == 0)
            return a / 3;
        else
            return (a / 3) + 1;
    }

    private static int getMaxWithSurprise(int a)
    {
        if (a == 0)
            return -1;
        else if ((a % 3) == 0)
            return (a / 3) + 1;
        else if (a % 3 == 1)
            return -1;
        else
            return (a / 3) + 2;
    }

    private static Integer[] sort(Integer[] arr)
    {
        for (int i = 0; i < arr.length - 1; ++i)
            for (int j = i + 1; j < arr.length; ++j)
                if (arr[i] < arr[j])
                {
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
        return arr;
    }

    public static void main(String[] args)
    {
        CodeJam2 cj = new CodeJam2();
        List<Data> inp = cj.getInputValue();
        // System.err.println(inp);

        // System.err.println(getMaxWithSurprise(15));

        int count = 1;

        // operating for each tc
        for (Data data : inp)
        {
            int surprise = data.getSurprise();
            int threshold = data.getThreshold();
            int answer = 0;

            Integer[] scores = sort(data.getValues());

            for (Integer score : scores)
            {
                // System.err.println(score + " " + getMaxWithSurprise(score) +
                // " " + getMaxWOSurprise(score));

                if (getMaxWOSurprise(score) >= threshold)
                    answer++;
                else if (surprise > 0 && getMaxWithSurprise(score) >= threshold)
                {
                    answer++;
                    surprise--;
                }
            }

            System.out.println("Case #" + count++ + ": " + answer);
        }

        // System.err.println(cj.generateCombination(24, 40));
    }
}
