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);
        }
    }
}

package codejam2.dancing;

import java.util.Scanner;

import codejam2.CodejamCase;
import codejam2.CodejamRunner;

public class Dancing extends CodejamRunner implements CodejamCase {

	private int nGooglers;
	private int surprising;
	private int pointMin;
	private int[] points;
	private String result;
	@Override
	public void compute() {
		int ns = 0;
		int s = 0;
		
		for(int i = 0; i < nGooglers; i++) {
			if(points[i] >= 3*pointMin-2)
				ns++;
			else if(pointMin>1 && points[i] >= 3*pointMin-4)
				s++;
		}
		result = String.valueOf(ns + Math.min(s, surprising));

	}

	@Override
	public String getOutput() {
		return result;
	}

	@Override
	public CodejamCase parseCase(Scanner s) {
		Dancing d = new Dancing();
		d.nGooglers = s.nextInt();
		d.surprising = s.nextInt();
		d.pointMin = s.nextInt();
		d.points = new int[d.nGooglers];
		for(int i = 0; i < d.nGooglers; i++)
			d.points[i] = s.nextInt();
		return d;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new Dancing().run(args);
	}

}
