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.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class DancingWithGooglers {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
	//	BufferedInputStream in = new BufferedInputStream(new FileInputStream("input.txt"));
		BufferedReader in = new BufferedReader(new FileReader("B-small-attempt0.in"));
		BufferedWriter out = new BufferedWriter(new FileWriter("output.txt"));
		int t = Integer.parseInt(in.readLine());
		int cnt = 0;
		while(t>0){
			t--; cnt++;
			int ans = 0;
			String s1 = in.readLine();
			String[] ss = s1.split(" ");
			int n = Integer.parseInt(ss[0]);
			int s = Integer.parseInt(ss[1]);
			int p = Integer.parseInt(ss[2]);
			int [] x = new int[n];
			for(int i=0; i<n; i++){
				int score = Integer.parseInt(ss[i+3]);
				int min = score / 3;
				int extra = score%3;
				if(min>=p){
					ans++;
					continue;
				}else if(p-min==1 && extra>0){
					ans++;
					continue;
				}else if((s>0 && extra==0 && p-min==1 && min != 0) || (s>0 && extra==2 && p-min==2 && min !=0)){
					ans++;
					s--;
					continue;
				}
			}
			out.write("Case #"+ cnt +": " + ans+"\n");
		}
		in.close();
		out.close();
	}

}
