package com.menzus.gcj._2012.qualification.b;

import com.menzus.gcj.common.InputBlockParser;
import com.menzus.gcj.common.OutputProducer;
import com.menzus.gcj.common.impl.AbstractProcessorFactory;

public class BProcessorFactory extends AbstractProcessorFactory<BInput, BOutputEntry> {
    public BProcessorFactory(String inputFileName) {
	super(inputFileName);
    }

    @Override
    protected InputBlockParser<BInput> createInputBlockParser() {
	return new BInputBlockParser();
    }

    @Override
    protected OutputProducer<BInput, BOutputEntry> createOutputProducer() {
	return new BOutputProducer();
    }
}

import java.util.*;
public class codejam {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int m=sc.nextInt();
		int i;
		int j;
		for(i=1;i<=m;i++) {
			int n=sc.nextInt();
			int s=sc.nextInt();
			int p=sc.nextInt();
			int count=0;
			for(j=0;j<n;j++) {
				int a=sc.nextInt();
				if(3*p-2<=a && p<=a) {
					count++;
				}
				else if(3*p-4<=a && p<=a && s>0) {
					s--;
					count++;
				}
			}
			System.out.println("Case #"+i+": "+count);
		}
	}

}
