package dancinggooglers;

import java.io.File;
import java.util.Scanner;

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}



//Author KNIGHT0X300 

import java.util.Scanner;




public class Main {
    
    public static void main(String[] args) {
       Scanner s=new Scanner(System.in);
       int t=s.nextInt();
      
       for(int i=0;i<t;i++)
       {  int tot=0;
           int N=s.nextInt();
           int S=s.nextInt();
           int p=s.nextInt();
   int A=0;     
           for(int j=0;j<N;j++)
           {
               
               A=s.nextInt();
            //  System.out.print(" "+A);
      if(p>=2)
      {    if(S>0)
       {  if((A==(3*p-4))||(A==(3*p-3)))
       {    tot++; S--;              }
       }
       if(A>=3*p-2)
           tot++;
           }
       if(p==0)
       {
       tot++;
       }
       if(p==1)
       {  
       if(A>=1)
       {//System.out.println("sdk");
           tot++;}
       }}
           
           
           
        System.out.println("Case #"+(i+1)+": "+tot);
                      
          
       }
        
    }
}
