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

public class DancingWithTheGooglers
{
    public DancingWithTheGooglers()
    {
        Scanner inFile = null;
        try
        {
            inFile = new Scanner(new File("inputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening input file. Exiting...");
			System.exit(0);
        }
        int t = inFile.nextInt();
        
        int [] results = new int [t];
        DancingWithTheGooglersMax [] rnc = new DancingWithTheGooglersMax[t];
        
        int i, j;
        int [] scores;
        int s, p;
        for(i = 0; i < t; i++)
        {
            scores = new int [inFile.nextInt()];
            s = inFile.nextInt();
            p = inFile.nextInt();
            for(j = 0; j < scores.length; j++)
                scores[j] = inFile.nextInt();
            
            rnc[i] = new DancingWithTheGooglersMax(i, scores, s, p, results);
            rnc[i].start();
        }
        inFile.close();
        
        boolean done = false;
        
        while(!done)
        {
            done = true;
            for(i = 0; i < t; i++)
                if(rnc[i].isAlive())
                {
                    done = false;
                    break;
                }
        }
        
        PrintWriter outFile = null;
        try
        {
            outFile = new PrintWriter(new File("outputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening output file. Exiting...");
			System.exit(0);
        }
        
        for(i = 0; i < results.length; i++)
            outFile.printf("Case #%d: %d\n", i+1, results[i]);
        outFile.close();
    }
    
    public static void main(String [] args)
    {
        new DancingWithTheGooglers();
    }
    
    private class DancingWithTheGooglersMax extends Thread
    {
        int id;
        int s, p;
        int [] results, scores;
        
        public DancingWithTheGooglersMax(int i, int [] aScores, int aS, int aP,int [] res)
        {
            id = i;
            s = aS;
            p = aP;
            results = res;
            scores = aScores;
        }
        
        public void run()
        {
            int a = 0, b = 0;
            
            if(p == 0)
                results[id] = scores.length;
            else if(p == 1)
            {
                int y;
                y = 3*p - 3;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > 0)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
            else
            {
                int y, z;
                y = 3*p - 3;
                z = 3*p - 5;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > z)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
        }
    }
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Madu
 */

import java.io.*;

public class Ex2 {
    
    public static void main(String[] args) {
        
          try{

  FileInputStream fstream = new FileInputStream("C:/Users/Madu/Documents/NetBeansProjects/CodeJamR1Ex1/input/A-small-attempt0.in");
  FileOutputStream fout = new FileOutputStream ("C:/Users/Madu/Documents/NetBeansProjects/CodeJamR1Ex1/output/out.txt");
  PrintStream printStream = new PrintStream(fout);
  // Get the object of DataInputStream
  DataInputStream in = new DataInputStream(fstream);
  BufferedReader br = new BufferedReader(new InputStreamReader(in));
  String inputIlne;
  br.readLine();
      //printStream.println ("Output");
  //Read File Line By Line
      int lineNum = 1;
  while ((inputIlne = br.readLine()) != null)   {
  // Print the content on the console
      
      //##########
	    
        String[] marks =  inputIlne.split(" ");
        
      
      
        int peopleCount = Integer.parseInt(marks[0].toString());
        int s = Integer.parseInt(marks[1].toString());
        int p = Integer.parseInt(marks[2].toString());
        
        int ans = 0;
        
    
        
          for (int i = 3; i < marks.length; i++) {            
            
            System.out.println(marks[i]);
            int total = Integer.parseInt(marks[i].toString());
            
            int value = total/3;
            int reminder = total%3;
            
            if(total==0){
                if(p==0){ans++;}
                
                continue;}
            
            if(reminder==0){
            
                if(value>=p){ans++;}
                else if(value+1>=p){
                
                    if(s>=1){ans++; s--;
                    }
                
                }
                
            }
            
            else if(reminder==1){
                
                if(value>=p){ans++;}
                else if(value+1>=p){ans++;}
            
            }
            
            else if(reminder==2){
            
                if(value>=p){ans++;}
                else if(value+1>=p){ans++;}
                else if(value+2>=p){
                    
                    if(s>=1){ans++; s--;}
                    }
            
            }
            
        }
        
        
        
        printStream.print ("Case #"+lineNum+": "+ans);lineNum++;
      
	  //###########
      printStream.println("");
  }
  //Close the input stream
  in.close();
  
  
    }catch (Exception e){//Catch exception if any
  System.err.println("Error: " + e.toString());
  }
        
    }
    
    
    
//    public static void main(String[] args) {
//        
//        String test = "2 1 1 8 0";
//        int peopleCount = Integer.parseInt(test.substring(0, 1));
//        int s = Integer.parseInt(test.substring(2, 3));
//        int p = Integer.parseInt(test.substring(4, 5));
//        
//        int ans = 0;
//        
//        //System.out.println(p);
//        
//        String[] marks = (test.substring(6)).split(" ");
//        
//        
//        
//        for (int i = 0; i < marks.length; i++) {            
//            
//            System.out.println(marks[i]);
//            int total = Integer.parseInt(marks[i].toString());
//            
//            int value = total/3;
//            int reminder = total%3;
//            
//            if(total==0){continue;}
//            
//            if(reminder==0){
//            
//                if(value>=p){ans++;}
//                else if(value+1>=p){
//                
//                    if(s>=1){ans++; s--;
//                    }
//                
//                }
//                
//            }
//            
//            else if(reminder==1){
//                
//                if(value>=p){ans++;}
//                else if(value+1>=p){ans++;}
//            
//            }
//            
//            else if(reminder==2){
//            
//                if(value>=p){ans++;}
//                else if(value+1>=p){ans++;}
//                else if(value+2>=p){
//                    
//                    if(s>=1){ans++; s--;}
//                    }
//            
//            }
//            
//        }
//        
//        
//        
//        System.out.println("Answer :"+ans);
//        
//    }
    
}
