package com.gcj.parser;

public class MaxPoints {

	public static int normal(int value){
		int toReturn = 0;
		switch (value) {
		case 0 : toReturn = 0 ; break;
		case 1 : toReturn = 1 ; break;
		case 2 : toReturn = 1 ; break;
		case 3 : toReturn = 1 ; break;
		case 4 : toReturn = 2 ; break;
		case 5 : toReturn = 2 ; break;
		case 6 : toReturn = 2 ; break;
		case 7 : toReturn = 3 ; break;
		case 8 : toReturn = 3 ; break;
		case 9 : toReturn = 3 ; break;
		case 10 : toReturn = 4 ; break;
		case 11 : toReturn = 4 ; break;
		case 12 : toReturn = 4 ; break;
		case 13 : toReturn = 5 ; break;
		case 14 : toReturn = 5 ; break;
		case 15 : toReturn = 5 ; break;
		case 16 : toReturn = 6 ; break;
		case 17 : toReturn = 6 ; break;
		case 18 : toReturn = 6 ; break;
		case 19 : toReturn = 7 ; break;
		case 20 : toReturn = 7 ; break;
		case 21 : toReturn = 7 ; break;
		case 22 : toReturn = 8 ; break;
		case 23 : toReturn = 8 ; break;
		case 24 : toReturn = 8 ; break;
		case 25 : toReturn = 9 ; break;
		case 26 : toReturn = 9 ; break;
		case 27 : toReturn = 9 ; break;
		case 28 : toReturn = 10 ; break;
		case 29 : toReturn = 10 ; break;
		case 30 : toReturn = 10 ; break;

		}

		return toReturn;
	}

	public static int surprising(int value){
		int toReturn = 0;
		switch (value) {
		case 0 : toReturn = 0 ; break;
		case 1 : toReturn = 1 ; break;
		case 2 : toReturn = 2 ; break;
		case 3 : toReturn = 2 ; break;
		case 4 : toReturn = 2 ; break;
		case 5 : toReturn = 3 ; break;
		case 6 : toReturn = 3 ; break;
		case 7 : toReturn = 3 ; break;
		case 8 : toReturn = 4 ; break;
		case 9 : toReturn = 4 ; break;
		case 10 : toReturn = 4 ; break;
		case 11 : toReturn = 5 ; break;
		case 12 : toReturn = 5 ; break;
		case 13 : toReturn = 5 ; break;
		case 14 : toReturn = 6 ; break;
		case 15 : toReturn = 6 ; break;
		case 16 : toReturn = 6 ; break;
		case 17 : toReturn = 7 ; break;
		case 18 : toReturn = 7 ; break;
		case 19 : toReturn = 7 ; break;
		case 20 : toReturn = 8 ; break;
		case 21 : toReturn = 8 ; break;
		case 22 : toReturn = 8 ; break;
		case 23 : toReturn = 9 ; break;
		case 24 : toReturn = 9 ; break;
		case 25 : toReturn = 9 ; break;
		case 26 : toReturn = 10 ; break;
		case 27 : toReturn = 10 ; break;
		case 28 : toReturn = 10 ; break;
		case 29 : toReturn = 10 ; break;
		case 30 : toReturn = 10 ; break;

		}
		return toReturn;
	}

}

package R0;

import java.io.*;
import java.util.*;

public class B {

	private static void solve(int TC) {
		int N = ni();
		int S = ni();
		int p = ni();
		int g[] = new int[N];
		for (int i = 0; i < g.length; i++)
			g[i] = ni();

		int ok = 3 * p - 2;
		int pok = ok - 2;
		if ( p == 1 )
			pok = 1;
		int ret = 0;
		for (int i : g) {
			if ( i >= ok ) {
				ret++;
				continue;
			}
			if ( S > 0 && i >= pok ) {
				ret++;
				S--;
			}
		}
		out.println(String.format("Case #%d: %d", TC, ret));
	}
	private static final boolean STDIO = false;
	private static final String TASK = "B";
	private static final String ROUND = "R0";
	private static final String DATA = "large";
	private static Scanner sc;
	private static PrintStream out;

	public static void main(String[] args) throws FileNotFoundException, IOException {
		Locale.setDefault(Locale.ENGLISH);

		String DATA_IN = String.format("tst/%s/%s.%s.in", ROUND, TASK, DATA);
		String DATA_OUT = String.format("tst/%s/%s.%s.out", ROUND, TASK, DATA);

		String str = null;
		if ( args.length > 0 )
			str = args[0];
		else if ( !STDIO )
			str = DATA_IN;
		sc = new Scanner((str != null) ? new FileInputStream(str) : System.in);

		str = null;
		if ( args.length > 1 )
			str = args[1];
		else if ( !STDIO )
			str = DATA_OUT;

		out = (str != null) ? new PrintStream(str) : System.out;

		int TC = ni();
		for (int i = 1; i <= TC; i++) {
			solve(i);
		}
	}

	private static int ni() {
		return sc.nextInt();
	}
}
