package util.graph;

import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Set;

public class DynDjikstra {
    public static State FindShortest(Node start, Node target) {
        PriorityQueue<Node> openSet = new PriorityQueue<>();
        Set<Node> closedSet = new HashSet<>();
        openSet.add(start);
        while (!openSet.isEmpty()) {
            Node current = openSet.poll();
            for (Edge edge : current.edges) {
                Node end = edge.target;
                if (closedSet.contains(end)) {
                    continue;
                }
                State newState = edge.travel(current.last);
                //if (end.equals(target)) {
                    //return newState;
                //}
                if (openSet.contains(end)) {
                    if (end.last.compareTo(newState)>0) {
                        end.last = newState;
                    }
                } else {
                    openSet.add(end);
                    end.last = newState;
                }
            }
            closedSet.add(current);
            if (closedSet.contains(target)) {
                return target.last;
            }
        }

        return target.last;
    }
}

import java.util.Scanner;


public class Dancing {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner readStuff = new Scanner(System.in);
		
		int numCases, numGooglers, numSurprises, numTarget;
		int scores, results = 0;
		
		numCases = readStuff.nextInt();
		
		for (int i = 0; i< numCases; i++) {
			numGooglers = readStuff.nextInt();
			numSurprises = readStuff.nextInt();
			numTarget = readStuff.nextInt();

			for (int j=0; j<numGooglers; j++) {
				scores = readStuff.nextInt();
				if (scores >= (3*numTarget - 2) && scores > 0) {
					results++;
				}
				else if (scores >= (3*numTarget-4) && scores > 0 && numSurprises > 0) {
					results++;
					numSurprises--;
				}
				if (scores == 0 && numTarget == 0) {
					results++;
				}
			}
			System.out.println("Case #" + (i+1) + ": " + results);
			results = 0;
		}
	}

}
