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.*;

class q2 {
    public static void main(String args[]) {
        Scanner obj = new Scanner(System.in);
        int T = obj.nextInt();
        try {
            FileOutputStream out = new FileOutputStream("myfile.txt");
            PrintStream p = new PrintStream(out);

            for (int i = 0; i < T; i++) {
                int No_googlers = obj.nextInt();
                int pp = obj.nextInt();
				int S = obj.nextInt();
                
                int cnt2 = 0;
                int cnt4 = 0;
                for (int j = 0; j < No_googlers; j++) {
                    int num = obj.nextInt();
                    
                    if (num >= (3 * pp - 2)) {
                        cnt2++;}
                    else if(num ==0){
                        cnt2=cnt2;
                    } else if (num >= (3 * pp - 4)) {
                        cnt4++;
                    }
                }
                System.out.println(cnt4);
                if (cnt4 > S) {
                    cnt2 = cnt2 + S;
                } else {
                    cnt2 = cnt2 + cnt4;
                }
                p.print("Case #" + (i+1) + ": " + cnt2);
                p.println();
            }
            p.close();
        } catch (Exception e) {
            System.err.println("Error writing to file");
        }
    }
}