import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;

public class b {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedInputStream(System.in));

        int T = sc.nextInt();

        for (int casenumber = 1; casenumber <= T; ++casenumber) {

            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();

            int[] ts = new int[n];
            for (int i = 0; i < n; ++i)
                ts[i] = sc.nextInt();

            int thresh1 = (p == 1 ? 1 : (3 * p - 4));
            int thresh2 = (3 * p - 2);

            int count1 = 0, count2 = 0;

            for (int i = 0; i < n; ++i) {
                if (ts[i] >= thresh2) {
                    ++count2;
                    continue;
                }
                if (ts[i] >= thresh1) {
                    ++count1;
                }
            }

            if (count1 > s) {
                count1 = s;
            }

            System.out.format("Case #%d: %d%n", casenumber, count1 + count2);
        }
    }
}

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Recycle {

	public Recycle()
	{
		readFile("Files/recycle.in");
	}
	public void readFile(String file)
	{
		try{
			FileInputStream fstream = new FileInputStream(file);
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine = "";
			br.readLine();
			int count = 1;
			while ((strLine = br.readLine()) != null)  
			{
				System.out.print("Case #" + (count++) + ": ");
				Scanner scanner = new Scanner(strLine);
				int numSurprising = 0;
				int p = 0;
				scanner.nextInt();
				int numMax = 0;
				numSurprising = scanner.nextInt();
				p = scanner.nextInt();
				while(scanner.hasNextInt())
				{
					int current = scanner.nextInt();
					if(current == 0 && p != 0)
						continue;
					else if(current == 0 && p == 0)
						numMax++;
					else if(current >= (3*p-2))
					{
						numMax++;
					}
					else if(numSurprising > 0 && ((3*p-2) - current) <= 2)
					{
						numSurprising--;
						numMax++;
					}
				}
					
					
				System.out.print(numMax);
				System.out.println();
			}
		}catch(Exception e){}
	}
	public static void main(String [] args)
	{
		Recycle r = new Recycle();
	}
}
