import java.util.*;
public class Test {
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int T = in.nextInt();

    for(int i = 1; i<=T; i++) {
      int n = in.nextInt();
      int s = in.nextInt();
      int p = in.nextInt();
      int result = 0;
      for(int j = 0; j<n; j++){
        int x = canAddUp(in.nextInt(), p);
        if(x == 0) {
          result++;
        } else if (x==1 && s > 0) {
          result++;
          s--;
        }
      }
      System.out.println("Case #"+i+": "+result);
    }
  }

  public static int canAddUp(int sum, int limit) {
    boolean flag = false;
    for(int i = 0; i<=sum; i++) {
      for(int j = 0; i+j <= sum; j++) {
        int k = sum-(i+j);
        int a = Math.abs(i-j);
        int b = Math.abs(i-k);
        int c = Math.abs(j-k);
        if(a > 2 || b > 2 || c> 2){
          continue;
        }

        if (i>=limit || j>=limit || k>=limit) {
          if(a < 2 && b < 2 && c < 2) {
            return 0;
          }else{
            flag = true;
          }
        }
      }
    }
    return (flag) ? 1 : 2;
  }
}

import java.io.*;
import java.util.*;


public class Solution {
	
	public static int calc(int N, int S, int p, int[] t){
		int ret = 0;
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for(int i=0; i<t.length; i++){
			if(Math.ceil((double)t[i]/3) >= p){
				ret ++;
			}
			// surprisingåè£
			else{
				list.add(new Integer(t[i]));
			}
		}
		
		// surprisingåè£ãéé ã«ã½ã¼ã
		Collections.sort(list, new Comparator<Integer>(){
		      public int compare(Integer t1, Integer t2) {
		          return t2 - t1;
		        }
		      });
		
		for(Integer ii : list){
			if(S>0){
				// surprisingã§+1æä½ã§ããæ¡ä»¶
				//   - åè¨å¤ã2ä»¥ä¸
				//   - åè¨å¤ãæ§æãã3ã¤ã®æ°å¤ã®ãã¡ã3ã¤ãåãæ° ã¾ãã¯ å¤§ããæ¹ã®2ã¤ãåãæ°
				if(ii.intValue() >= 2 && (ii.intValue()%3 != 1)){
					// åè¨å¤ã3ã§å²ã£ãå¤ãåãä¸ãã¦æå¤§å¤ã¨ãã
					if(Math.ceil((double)ii.intValue()/3) >= p-1){
						//System.out.println("includes surprising " + ii.intValue() + "->" + (Math.ceil((double)ii.intValue()/3)+1) + "," + "other");
						ret ++;
						S --;
						if(S == 0){
							break;
						}
					}
				}
			}
		}
		
		return ret;
	}
	
	public static void main(String[] args){
        if(args.length == 0){
            System.exit(1);
        }

        try{
            FileReader fr = new FileReader(args[0]);
            BufferedReader br = new BufferedReader(fr);
            
            FileOutputStream fos = new FileOutputStream("output.out");
            OutputStreamWriter osw = new OutputStreamWriter(fos , "UTF-8");
            BufferedWriter bw = new BufferedWriter(osw);
            
            String tmp_str;
            
            tmp_str = br.readLine();
            
            int numOfCases = Integer.parseInt(tmp_str);
            int caseIndex = 0;

            while((tmp_str = br.readLine()) != null){
            	caseIndex++;

                StringTokenizer st = new StringTokenizer(tmp_str, " ");
                int numOfTokens = st.countTokens();
                String[] tokenOfLine = new String[numOfTokens];
                for(int i=0; i<numOfTokens; i++){
                	tokenOfLine[i] = st.nextToken();
                }
                
                int N = Integer.parseInt(tokenOfLine[0]);
                int S = Integer.parseInt(tokenOfLine[1]);
                int p = Integer.parseInt(tokenOfLine[2]);
                
                //System.out.println("N:" + N);
                //System.out.println("S:" + S);
                //System.out.println("p:" + p);
                
                int[] t = new int[N];
                for(int i=0; i<N; i++){
                	int j=i+3;
	                t[i] = Integer.parseInt(tokenOfLine[j]);
	                //System.out.println("t[" + i + "]:" + t[i]);
                }
                
                int ret = calc(N, S, p, t);
                
                System.out.println("Case #" + caseIndex + ": " + ret);
                
            	if(caseIndex==numOfCases){
                	bw.write("Case #" + caseIndex + ": " + ret);
            	}else{
                	bw.write("Case #" + caseIndex + ": " + ret + "\n");
            	}
            }
            br.close();
            bw.close();
            osw.close();
            fos.close();

 
        }
        catch(IOException e){
            e.printStackTrace();
            System.exit(1);
        }

	}
}
