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.File;
import java.io.FileNotFoundException;
import java.util.LinkedList;
import java.util.Scanner;


public class dancing {
	
	public static int maxScore(int a){
		if(a==0) return 0;
		return ((a%3)==0)?(a/3)+1:(a%3)+a/3;
	}
	
	public static int maxScoreSanSurprise(int a){
		return (a/3)+Math.min(1, a%3);
	}
	
	public static int solveOne(Scanner scan){
		int n = scan.nextInt();
		int s = scan.nextInt();
		int p = scan.nextInt();
		int nbok =0;
		LinkedList<Integer> possible = new LinkedList<Integer>();
		for(int i=0; i<n; i++){
			int tmp = scan.nextInt();
			if(maxScoreSanSurprise(tmp)>=p){
			//	System.out.println("sans surprise"+tmp);
				nbok++;
			}
			else if(maxScore(tmp)>= p){
				//System.out.println("avec surprise"+tmp);
				possible.add(tmp);
			}
			else{
				//System.out.println("impossible"+tmp+" "+maxScore(tmp)+" "+maxScoreSanSurprise(tmp));
			}
		}
		return nbok+Math.min(s, possible.size());
	}
	
	public static void main(String[] args) throws FileNotFoundException{
		Scanner s = new Scanner(new File("input.txt"));
		int nbcas = s.nextInt();
		for(int i=0; i<nbcas; i++){
			System.out.println("Case #"+(i+1)+": "+solveOne(s));
		}
	}
}
