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.util.Scanner;

public class CodeB{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int tcase;
		int numGoogler, surprising, min;
		int totTriplets, surprisingUsed;
		int getMinMax;
		
		tcase=sc.nextInt();
		for(int q=1;q<=tcase;q++){
			surprisingUsed=0;
			getMinMax=0;
			numGoogler=sc.nextInt();
			surprising=sc.nextInt();
			min=sc.nextInt();
			for(int i=0;i<numGoogler;i++){
				totTriplets=sc.nextInt();
				//System.out.println((totTriplets%3)+" "+(totTriplets/3));
				if(totTriplets%3==0){
					if(totTriplets/3>=min){
						getMinMax++;
					}
					else if((totTriplets/3)!=0 && (totTriplets/3)+1>=min && surprisingUsed<surprising){
						getMinMax++;
						surprisingUsed++;
					}
				}
				else if(totTriplets%3==1 && (totTriplets/3)+1>=min){
					getMinMax++;
				}
				else if(totTriplets%3==2){
					if((totTriplets/3)+1>=min){
						getMinMax++;
					}
					else if((totTriplets/3)+2>=min && surprisingUsed<surprising){
						getMinMax++;
						surprisingUsed++;
					}
				}
			}
			System.out.println("Case #"+q+": "+getMinMax);
		}
	}
}