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.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.nio.Buffer;
import java.util.Arrays;
import java.util.Scanner;

public class DancingWithGooglers {

    public static void main(String[] args) throws Exception {
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("/home/xnike/Downloads/B-small-attempt0.out"));
        Scanner scanner = new Scanner(new File("/home/xnike/Downloads/B-small-attempt0.in"));

        int t = scanner.nextInt();
        scanner.nextLine();

        for (int i = 0; i < t; i++) {
            int n = scanner.nextInt(), s = scanner.nextInt(), p = scanner.nextInt();
            int[] ti = new int[n];

            for (int j = 0; j < n; j++) {
                ti[j] = scanner.nextInt();
            }
            scanner.nextLine();

            Arrays.sort(ti);

            int num = 0;
            for (int k = ti.length - 1; k > -1; k--) {
                int min = ti[k] / 3, max = ti[k] - 2 * (ti[k] / 3);

                if (0 == max - min && 2 < ti[k]) {
                    max++;
                    min--;
                }

                if (max >= p) {
                    if (max == p && (2 == max - min)) {
                        if (0 < s) {
                            s--;
                            num++;
                        }
                    } else {
                    num++;
                    }
                }
            }

            bufferedWriter.write("Case #" + (i + 1)  + ": " + num + "\n");
        }

        bufferedWriter.flush();
    }
}
