/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lance Chen
 */
public class CodeHelper {

    private static String FILE_ROOT = "D:/workspace/googlecodejam/meta";

    public static List<List<String>> loadInputsExcludes(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        int index = 0;
        for (String line : lines) {
            if (index == 0) {
                index++;
                continue;
            }
            if (index % 2 == 1) {
                index++;
                continue;
            }
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
            index++;
        }
        return result;
    }

    public static List<List<String>> loadInputs(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        for (String line : lines) {
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
        }
        return result;
    }

    public static List<String> loadInputLines(String fileName) {
        return FileUtil.readLines(FILE_ROOT + fileName);
    }

    public static void writeOutputs(String fileName, List<String> lines) {
        FileUtil.writeLines(FILE_ROOT + fileName, lines);
    }
}

import java.io.*;

public class template {
	public static void main(String[] args) throws IOException {
		StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		//PrintWriter out = new PrintWriter("output.txt");
		
		in.nextToken(); int count = (int)in.nval;
		
		for(int c = 1 ; c <= count ; c++) {
			in.nextToken(); int googlers = (int) in.nval;
			in.nextToken(); int surprisings = (int) in.nval;
			in.nextToken(); int passScore = (int) in.nval;
			
			int pass = 0;
			int passWithSurprising = 0;			

			// loop through scores
			for(int i = 0 ; i < googlers ; i++) {
				in.nextToken(); int score = (int) in.nval;
				
				int division = score / 3;
				int modulo = score % 3;
				
				if (modulo > 0) division++;
				
				if (division >= passScore) {
					pass++;
				} else if (division+1 == passScore && modulo!=1 && score!=0) {
					passWithSurprising++;
				}
			}
			
			out.println("Case #" + c + ": " + (pass + Math.min(passWithSurprising, surprisings)));
		}
		
		out.flush();
		out.close();
	}
}
