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

/*
 * Dancing
 * Jason Bradley Nel
 * 16287398
 */
import java.io.*;

public class Dancing {

    public static void main(String[] args) {

        In input = new In("input.txt");
        int T = Integer.parseInt(input.readLine());

        for (int i = 0; i < T; i++) {
            System.out.printf("Case #%d: ", i + 1);
            int N = input.readInt();
            int s = input.readInt();
            int p = input.readInt();
            int c = 0;//counter for >=p cases
            //System.out.printf("N: %d, S: %d, P: %d, R: ", N, s, p);
            
            for (int j = 0; j < N; j++) {
                
                int score = input.readInt();
                int q = score / 3;
                int m = score % 3;
                //System.out.printf("%2d (%d, %d) ", scores[j], q, m);
                                
                switch (m) {
                    case 0:
                        if (q >= p) {
                            c++;
                        } else if (((q + 1) == p) && (s > 0) && (q != 0)) {
                            c++;
                            s--;
                        }
                        break;
                    case 1:
                        if (q >= p) {
                            c++;
                        } else if ((q + 1) == p) {
                            c++;
                        }
                        break;
                    case 2:
                        if (q >= p) {
                            c++;
                        } else if ((q + 1) == p) {
                            c++;
                        } else if (((q + 2) == p) && (s > 0)) {
                            c++;
                            s--;
                        }
                        break;
                }
            }
            //System.out.printf("Best result of %d or higher: ", p);
            System.out.println(c);
        }


    }
}

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

package adream;

import java.util.Scanner;

/**
 *
 * @author sarah
 */
public class GoogleDancers {

    public int max(int[] googs , int p , int s){
        int surp = 0;
        int max  = 0;
        if(p == 0)
            return googs.length;
        for(int i = 0 ; i < googs.length ; i++){
            int g1=0,g = googs[i];   
            if(g == 0)continue;
            if(g%3 == 0){
                if(surp < s && g/3 < p && g/3 +1 >= p){
                    g1 = g/3 +1;
                    surp++;
                }else
                    g1 = g/3 ;
            }else{
                if((g+1) % 3 == 0){
                    if(surp < s &&(g+1)/3 <p && (g+1)/3 + 1 >= p){
                        g1 = (g+1)/3 + 1;                   
                        surp++;
                    }else
                        g1 = (g+1)/3;
                }else{
//                     if(surp < s &&(g-1)/3 + 1 < p && (g-1)/3 + 1 >= p){
//                        g1 = (g+1)/3 + 1;                   
//                        surp++;
//                    }else
                        g1 = (g-1)/3 +1;
                }
            }
            if(g1 >= p)
                max++;

        }

        return max;
    }


    public static void main(String args[]){
        GoogleDancers gd = new GoogleDancers();
        Scanner sc = new Scanner(System.in);
        int tc = sc.nextInt();
        int i = 0 ;
        while(i++ < tc){
            int n = sc.nextInt(); // dancers
            int s = sc.nextInt(); //surprising
            int p = sc.nextInt(); //max
            int[] dancers = new int[n];
            for(int j = 0 ; j < n ; j++)
                dancers[j] = sc.nextInt();
            int res = gd.max(dancers,p,s);
            System.out.println("Case #"+i +": "+res);
        }
    }
}
