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.io.*;
import java.util.*;
import java.lang.Math.*;

public class DancingWithTheGooglers {

	public static void main(String[] args) throws IOException{
		Scanner in = new Scanner(new File("DancingWithTheGooglers.in"));
	    PrintWriter p = new PrintWriter("DancingWithTheGooglers.out");
	    int t = Integer.parseInt(in.nextLine());
	    int n;
	    int s;
	    int h;
	    int q;
	    int [] d = new int[100]; 
	    for(int c = 1; c < t+1; c++){
	    	q = 0;
	    	n = Integer.parseInt(in.next());
	    	s = Integer.parseInt(in.next());
	    	h = Integer.parseInt(in.next())-1;
	    	for (int i = 0; i < n; i++){
	    		d[i] = Integer.parseInt(in.next());
	    		if(d[i] > 3*h){
	    			q++;
	    		}else if((d[i]==3*h||d[i]==3*h-1)&&s > 0&& h!= 0){
	    			q++;
	    			s--;
	    		}
	    	}
	    	p.println("Case #"+c+": "+q);
	    	if(c!=t)in.nextLine();
	    }
	    in.close();
	    p.close();
	}

}