package codejam;

import fixjava.Pair;

public class Utils {

	public static long minLong(long firstVal, long... otherVals) {
		long minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static int minInt(int firstVal, int... otherVals) {
		int minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static float minFloat(float firstVal, float... otherVals) {
		float minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	/**
	 * ArgMin returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMin(int[] arr) {
		int min = arr[0];
		int argMin = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] < min) {
				min = arr[i];
				argMin = i;
			}
		}
		return new Pair<Integer, Integer>(argMin, min);
	}

	/**
	 * ArgMax returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMax(int[] arr) {
		int max = arr[0];
		int argMax = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] > max) {
				max = arr[i];
				argMax = i;
			}
		}
		return new Pair<Integer, Integer>(argMax, max);
	}

}

import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class mainclass {
	
	public static void main(String args[]) throws IOException {
		
		int cases;
		int n;
		int s;
		int p;
		int t;
		int flag;
		int counter;
		int[] data;
		int[] arr;
		int surp;
		
		FileWriter fstream = new FileWriter("out.txt");
    	BufferedWriter out = new BufferedWriter(fstream);
		
		FileReader isr = new FileReader(args[0]);
		Scanner src = new Scanner(isr);
    
		cases = src.nextInt();
		
		for(int j=0;j<cases;j++)
		{
			counter = 0;
			surp = 0;
			n = src.nextInt();
			s = src.nextInt();
			p = src.nextInt();
			data = new int [n];
			arr = new int[31];
			for(int i=0;i<31;i++)
				arr[i] = 0;
			
			for(int i=0;i<n;i++)
			{
				arr[src.nextInt()]++;
			}
			
			for(int i=0;i<31;i++)
			{
				if(i>=(p*3-2))
					counter = arr[i]+counter;
				if((i==p*3-3||i==p*3-4)&&i>0)
					surp = arr[i]+surp;
			}
			
			if(surp>s)
				counter = s+counter;
			else
				counter = surp+counter;
			
			try{
				out.write("Case #"+(j+1)+": "+counter);
		    	out.write("\r\n");
		    	}catch (Exception e){
		    	System.err.println("Error: " + e.getMessage());
		    }
		}
		
		out.close();
	}
}
