/*
 * 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.util.Scanner;

public class CodeB{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int tcase;
		int numGoogler, surprising, min;
		int totTriplets, surprisingUsed;
		int getMinMax;
		
		tcase=sc.nextInt();
		for(int q=1;q<=tcase;q++){
			surprisingUsed=0;
			getMinMax=0;
			numGoogler=sc.nextInt();
			surprising=sc.nextInt();
			min=sc.nextInt();
			for(int i=0;i<numGoogler;i++){
				totTriplets=sc.nextInt();
				//System.out.println((totTriplets%3)+" "+(totTriplets/3));
				if(totTriplets%3==0){
					if(totTriplets/3>=min){
						getMinMax++;
					}
					else if((totTriplets/3)!=0 && (totTriplets/3)+1>=min && surprisingUsed<surprising){
						getMinMax++;
						surprisingUsed++;
					}
				}
				else if(totTriplets%3==1 && (totTriplets/3)+1>=min){
					getMinMax++;
				}
				else if(totTriplets%3==2){
					if((totTriplets/3)+1>=min){
						getMinMax++;
					}
					else if((totTriplets/3)+2>=min && surprisingUsed<surprising){
						getMinMax++;
						surprisingUsed++;
					}
				}
			}
			System.out.println("Case #"+q+": "+getMinMax);
		}
	}
}