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.File;
import java.io.FileNotFoundException;
import java.util.Scanner;


public class B {

	/**
	 * @param args
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub

		Scanner S = new Scanner(new File("B-small-attempt2.in"));

		//Scanner S = new Scanner(System.in);

		int t = S.nextInt();

		for (int i = 1; i <= t; i++) {
			int n = S.nextInt();
			int surprise  = S.nextInt();
			int p = S.nextInt();
			int cases =0;

			for (int j = 0; j < n; j++) {
				int score = S.nextInt();
				int base = (int)score /3;
				
	            if(base*3 == score&& base>=p)
	                cases++;
	            else if(base*3 == score &&  surprise!=0 && base+1>=p && score > p){
	                cases++;
	                surprise--;
	            }
	            else if(score - (base*3) == 1 && base+1 >=p)
	                cases++;
	            else if((score - (base*3) == 2) && (base>=p || base+1>=p)){
	                cases++;
	            }else if((score - (base*3) == 2) && base+2 >=p && surprise!=0){
	                 cases++;
	                 surprise--;
	            }
			


			}

			System.out.println("Case #"+i+": "+cases);

		}

	}

}
