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;
  }
}

package gdwg;

import java.io.*;

/**
 *
 * @author alexho
 */
public class GDWG {
    
    private static int [] result;
    
    
    private void readInput (String infn) throws FileNotFoundException, IOException {
        String line = null;        
        int testCases = 0;
        BufferedReader bufRdr = null;      
        String delimiter = " ";
        File file = new File(infn);
        bufRdr = new BufferedReader(new FileReader(file));            

        testCases = Integer.valueOf(bufRdr.readLine());        
        GDWG.result = new int [testCases];
        
        int index=0;
                
        while ( (line = bufRdr.readLine()) != null ) {
                        
            String [] temp;            
            temp = line.split(delimiter);            
            this.computeMax(temp, index);            
            index++;

        }
        bufRdr.close();

        
    }
    
    private void output (String outfn) throws IOException {
        PrintWriter out = new PrintWriter(new FileWriter(outfn));
        for (int i=0;i<GDWG.result.length;i++) {
            out.println("Case #"+(i+1)+": "+GDWG.result[i]);

        }
        out.close();        
    }
    
    private void computeMax (String [] tempS, int index) {
        
        int N,S,p, max=0,Nti;
        N = Integer.valueOf(tempS[0]);
        S = Integer.valueOf(tempS[1]);
        p = Integer.valueOf(tempS[2]);
        
        for (int i=3;i<tempS.length;i++) {
            Nti = Integer.valueOf(tempS[i]);
            
            // 1st case
            if (p == 0) {
                max++;
            } else if (p > Nti) {
                // do nothing
            } else if (Nti/3 >= p) {
                max++;                
            } else if (p - Nti/3 <=2 && p - Nti/3 > 0 ) {
                if ( 3*p == Nti) {
                        max++;
                    } else if (3*p+1 == Nti) {
                        max++;
                    } else if (3*p-1 == Nti) {
                        max++;
                    } else if (3*p-2 == Nti) {
                        max++;
                    } else if (3*p+2 == Nti) {
                        max++;
                    } else if (3*p-3 == Nti && S > 0) {
                        S--;
                        max++;
                    } else if (3*p+3 == Nti && S > 0) {
                        S--;
                        max++;
                    } else if (3*p-4 == Nti && S > 0) {
                        S--;
                        max++;
                    } else if (3*p+4 == Nti && S > 0) {
                        S--;
                        max++;
                    }
                
            } else {
                
            }
            
            
                                                                           
        }
        GDWG.result[index]=max;
    }
    
    public GDWG () {
        
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, IOException {
        
        String infn = args[0];
        String outfn = args[1];
        GDWG gdwg = new GDWG();
        gdwg.readInput(infn);
        gdwg.output(outfn);
        for (int i=0;i<GDWG.result.length;i++) {
            System.out.println(GDWG.result[i]);
        }
        
    }
}
