/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 3/3/12
 * Time: 11:00 AM
 * To change this template use File | Settings | File Templates.
 */

import SRMLib.MathLibrary;
import SRMLib.TestSRMLib;
import com.sun.org.apache.bcel.internal.generic.F2D;

import java.io.*;
import java.util.*;
import java.util.zip.Inflater;

public class SRM {
    public static void main(String[] args) throws IOException {
        //TestSRMLib.run();
        codeJam1.main();

        return;
    }
}
class codeJam1 {
    public static void main() throws IOException {
        String inputPath = "E:\\input.txt";
        String outputPath = "E:\\output.txt";
        BufferedReader input = new BufferedReader(new FileReader(inputPath));
        BufferedWriter output = new BufferedWriter(new FileWriter(outputPath));

        String line;
        line = input.readLine();
        int T = Integer.parseInt(line);
        for (int i = 1; i <= T; ++i) {
            line = input.readLine();
            String[] words = line.split(" ");
            int N = Integer.parseInt(words[0]);
            int S = Integer.parseInt(words[1]);
            int p = Integer.parseInt(words[2]);
            int n = 0;
            int res = 0;

            for (int j = 3; j < words.length; ++j) {
                if (p == 0) {
                    res++;
                    continue;
                }

                int t = Integer.parseInt(words[j]);
                if (p == 1) {
                    if (t > 0)
                        res++;
                    continue;
                }
                if (t >= 3 * p - 2)
                    res++;
                else if (t >= 3 * p - 4)
                    n++;
            }

            res += Math.min(n, S);
            output.write("Case #" + i + ": " + res);
            output.newLine();
        }

        input.close();
        output.close();
    }
}

package qual;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Googlers {
	public static void main(String[] args) throws IOException {
		new Googlers().run();
	}
	int solve(int s, int p, int[] scores) {
		Arrays.sort(scores);
		for (int i = 0; i < scores.length / 2; i++) {
			int t = scores[i];
			scores[i] = scores[scores.length - 1 - i];
			scores[scores.length - 1 - i] = t;
		}
		int count = 0;
		for (int i = 0; i < scores.length; i++) {
			int cur = scores[i];
			int a, b, c;
			if (cur % 3 == 0) {
				a = cur / 3;
				b = cur / 3;
				c = cur / 3;
			} else if (cur % 3 == 1) {
				a = cur / 3 + 1;
				b = cur / 3;
				c = cur / 3;
			} else {
				a = cur / 3 + 1;
				b = cur / 3 + 1;
				c = cur / 3;
			}
			
			if (a >= p)
				count++;
			else {
				if (a == b && b > 0 && s > 0) {
					a++;
					b--;
					if (a >= p) {
						count++;
						s--;
					}
				}
			}
		}
		return count;
	}
	public void run() throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int testsCount = in.nextInt();
		for (int t = 0; t < testsCount; t++) {
			int n = in.nextInt(), s = in.nextInt(), p = in.nextInt();
			int[] scores = new int[n];
			for (int i = 0; i < n; i++) {
				scores[i] = in.nextInt();
			}
			int ans = solve(s, p, scores);
			out.printf("Case #%d: %d\n", t + 1, ans);
		}
		
		out.close();
	}
}
