/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 3/3/12
 * Time: 11:00 AM
 * To change this template use File | Settings | File Templates.
 */

import SRMLib.MathLibrary;
import SRMLib.TestSRMLib;
import com.sun.org.apache.bcel.internal.generic.F2D;

import java.io.*;
import java.util.*;
import java.util.zip.Inflater;

public class SRM {
    public static void main(String[] args) throws IOException {
        //TestSRMLib.run();
        codeJam1.main();

        return;
    }
}
class codeJam1 {
    public static void main() throws IOException {
        String inputPath = "E:\\input.txt";
        String outputPath = "E:\\output.txt";
        BufferedReader input = new BufferedReader(new FileReader(inputPath));
        BufferedWriter output = new BufferedWriter(new FileWriter(outputPath));

        String line;
        line = input.readLine();
        int T = Integer.parseInt(line);
        for (int i = 1; i <= T; ++i) {
            line = input.readLine();
            String[] words = line.split(" ");
            int N = Integer.parseInt(words[0]);
            int S = Integer.parseInt(words[1]);
            int p = Integer.parseInt(words[2]);
            int n = 0;
            int res = 0;

            for (int j = 3; j < words.length; ++j) {
                if (p == 0) {
                    res++;
                    continue;
                }

                int t = Integer.parseInt(words[j]);
                if (p == 1) {
                    if (t > 0)
                        res++;
                    continue;
                }
                if (t >= 3 * p - 2)
                    res++;
                else if (t >= 3 * p - 4)
                    n++;
            }

            res += Math.min(n, S);
            output.write("Case #" + i + ": " + res);
            output.newLine();
        }

        input.close();
        output.close();
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

/**
 *
 * @author sarwar
 */
public class problemB {
    
    static int diff(int a,int b,int c){
        return Math.max(Math.max(Math.abs(a-b), Math.abs(b-c)),Math.abs(c-a));
    }
    static int func(int score, int least){
        int val=0,possible=0,surprise=0;
        while(least<=30){
            if(least-1>=0 && score-least-least+1>=0){
                val = diff(least,least-1,score-least-least+1);
                if(val==0||val==1){possible++;break;}
                else if(val==2){surprise++;}
            }
            if(least-2>=0 && score-least-least+2>=0){
                val = diff(least,least-2,score-least-least+2);
                if(val==0||val==1){possible++;break;}
                else if(val==2){surprise++;}
            }
            if(score-least-least>=0){
                val = diff(least,least,score-least-least);
                if(val==0||val==1){possible++;break;}
                else if(val==2){surprise++;}
            }
            if(score-least-least-1>=0){
                val = diff(least,least+1,score-least-least-1);
                if(val==0||val==1){possible++;break;}
                else if(val==2){surprise++;}
            }
            if(score-least-least-2>=0){
                val = diff(least,least-2,score-least-least-2);
                if(val==0||val==1){possible++;break;}
                else if(val==2){surprise++;}
            }
            least++;
        } 
        if(possible==1)return 0;
        else if(surprise >= 1)return 1;
        else return 3;
    }
    
    public static void main(String args[]) throws IOException{
        //System.out.println(func(29,12));
        BufferedWriter out = new BufferedWriter(new FileWriter("D:\\output.txt"));
        Scanner sc = new Scanner(new File("D:\\input.txt"));
        int test = sc.nextInt();
        for(int i=0;i<test;i++){
            int googlers = sc.nextInt();
            int surprise = sc.nextInt();
            int least = sc.nextInt();
            //int[] score = new int[googlers];
            int fsurprise=0,fnormal=0,fimpossible=0;
            for(int j=0;j<googlers;j++){
                int val = sc.nextInt();
                //System.out.print(val + "  ");
                val = func(val,least);
                //System.out.print(val + "  ");
                if(val==0)fnormal++;
                else if(val==1)fsurprise++;
                else fimpossible++;
            }
            if(surprise>fsurprise){
                out.write("Case #" + (i+1) + ": " + String.valueOf(fnormal+fsurprise));
            }
            else{
                out.write("Case #" + (i+1) + ": " + String.valueOf(fnormal+surprise));
            }
            out.newLine();
            //System.out.println(googlers + " " + surprise + " " + least + " " + score[googlers-1]);
        }
        out.close();
    }
    
}
