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);
        }
    }
}


public class Triplet implements Comparable<Triplet> {
	
	private int s1;
	private int s2;
	private int s3;
	
	public Triplet(int _s1,int _s2,int _s3){
		s1=_s1;
		s2=_s2;
		s3=_s3;
	}
	
	@Override
	public int compareTo(Triplet o) {
		return new Integer(o.getMax()).compareTo(this.getMax());
	}
	
	public boolean isSurprising(){
		if(Math.abs(s1-s2)==2 || Math.abs(s1-s3)==2 || Math.abs(s2-s3)==2) return true;
		return false;
	}
	
	public int getMax(){
		if(s1>s2 && s1>s3) return s1;
		else if (s2>s3) return s2;
		else return s3;
	}
	
	public void setS1(int s1) {
		this.s1 = s1;
	}
	public int getS1() {
		return s1;
	}
	public void setS2(int s2) {
		this.s2 = s2;
	}
	public int getS2() {
		return s2;
	}
	public void setS3(int s3) {
		this.s3 = s3;
	}
	public int getS3() {
		return s3;
	}
	
	

}
