import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;

public class b {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedInputStream(System.in));

        int T = sc.nextInt();

        for (int casenumber = 1; casenumber <= T; ++casenumber) {

            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();

            int[] ts = new int[n];
            for (int i = 0; i < n; ++i)
                ts[i] = sc.nextInt();

            int thresh1 = (p == 1 ? 1 : (3 * p - 4));
            int thresh2 = (3 * p - 2);

            int count1 = 0, count2 = 0;

            for (int i = 0; i < n; ++i) {
                if (ts[i] >= thresh2) {
                    ++count2;
                    continue;
                }
                if (ts[i] >= thresh1) {
                    ++count1;
                }
            }

            if (count1 > s) {
                count1 = s;
            }

            System.out.format("Case #%d: %d%n", casenumber, count1 + count2);
        }
    }
}

import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;


public class DancingWithGooglers {

	public static void main(String[] args) throws IOException{
		
		String path = "C:\\Users\\Rapol Tongchenchitt\\Documents\\CodeJam\\";
		String year = "Qual2012\\";
		
		String test = "input.txt"; String outPath = "output.txt";
		String a = ""; String A = "";
		String b = "B-small-attempt0.in"; String B = "B-small-attempt0.out";
		String c = ""; String C = "";
		String d = ""; String D = "";
		
		String inName = path+year+b;
		String outName = path+year+B;
		
		Scanner in = new Scanner(new FileInputStream(inName));
		BufferedWriter out = new BufferedWriter(new FileWriter(outName));
		
		int caseCount = in.nextInt(); int currentCase = 0;
		
		while(currentCase++ < caseCount){
			
			int dancerCount = in.nextInt();
			int surpriseCount = in.nextInt();
			int minScore = in.nextInt();
			
			int goodCount = 0;
			int maybeCount = 0;
			
			for(int i = 0; i < dancerCount; i++){
				int now = in.nextInt();
				int min;
				
				switch(now%3){
				case 0:
					min = now/3;
					if(min == 0){
						if (minScore == 0){
							goodCount++;
						}
					}else if(min >= minScore){
						goodCount++;
					}else if(min + 1 == minScore){
						maybeCount++;
					}
					break;
					
				case 1:
					min = (now/3) + 1;
					if(min >= minScore){
						goodCount++;
					}
					break;
					
				case 2:
					min = (now/3) + 1;
					if(min >= minScore){
						goodCount++;
					}else if(min + 1 == minScore){
						maybeCount++;
					}
					break;
					
				}
			}
			
			goodCount += Math.min(maybeCount, surpriseCount);
			
			out.write("Case #" + currentCase + ": " + goodCount);
			out.newLine();
		}
		
		out.close();
		
	}
	
}
