import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;


public class B {
	static int[][] memo;
	static int[] nums;
	static int p;
	public static void main(String[] args)throws IOException
	{
		Scanner br=new Scanner(new File("B-small-attempt0.in"));
		PrintWriter out=new PrintWriter(new File("b.out"));
		int cases=br.nextInt();
		for(int c=1;c<=cases;c++)
		{
			int n=br.nextInt(),s=br.nextInt();
			p=br.nextInt();
			nums=new int[n];
			for(int i=0;i<n;i++)
				nums[i]=br.nextInt();
			memo=new int[n][s+1];
			for(int[] a:memo)
				Arrays.fill(a,-1);
			out.printf("Case #%d: %d\n",c,go(0,s));
		}
		out.close();
	}
	public static int go(int index,int s)
	{
		if(index>=nums.length)
			return 0;
		if(memo[index][s]!=-1)
			return memo[index][s];
		int best=0;
		for(int i=0;i<=10;i++)
		{
			int max=i;
			for(int j=0;j<=10;j++)
			{	
				if(Math.abs(i-j)>2)
					continue;
				max=Math.max(i,j);
				thisone:
				for(int k=0;k<=10;k++)
				{
					int ret=0;
					if(Math.abs(i-k)>2||Math.abs(j-k)>2)
						continue;
					max=Math.max(max,k);
					int count=0;
					if(Math.abs(i-k)==2)
						count++;
					if(Math.abs(i-j)==2)
						count++;
					if(Math.abs(j-k)==2)
						count++;
					if(i+j+k==nums[index])
					{
						boolean surp=(count>=1);
						if(surp&&s>0)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s-1);
						}
						else if(!surp)
						{
							if(max>=p)
								ret++;
							ret+=go(index+1,s);
						}
						best=Math.max(best,ret);
					}
					else if(i+j+k>nums[index])
						break thisone;
				}
			}
		}
		return memo[index][s]=best;
	}
}

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