import java.util.Scanner;
public class B {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		for(int zz = 1; zz <= T;zz++){
			int N = in.nextInt();
			int S = in.nextInt();
			int p = in.nextInt();
			int x = 0;
			for(int i = 0; i < N;i++){
				int score = in.nextInt();
				int best = score/3;
				int mod = score%3;
				int diff = p-best;
				if(diff<1){
					x++;
				}else if(diff<2){
					if(mod==0 && score !=0){
						if(S!=0){
							S--;x++;
						}
					}else if(score!=0){
						x++;
					}
				}else if(diff<3){
					if(mod==2){
						if(S!=0){
							S--;x++;
						}
					}
				}
			}
			System.out.format("Case #%d: %d\n", zz, x);
		}
	}
}

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