package util.graph;

import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Set;

public class DynDjikstra {
    public static State FindShortest(Node start, Node target) {
        PriorityQueue<Node> openSet = new PriorityQueue<>();
        Set<Node> closedSet = new HashSet<>();
        openSet.add(start);
        while (!openSet.isEmpty()) {
            Node current = openSet.poll();
            for (Edge edge : current.edges) {
                Node end = edge.target;
                if (closedSet.contains(end)) {
                    continue;
                }
                State newState = edge.travel(current.last);
                //if (end.equals(target)) {
                    //return newState;
                //}
                if (openSet.contains(end)) {
                    if (end.last.compareTo(newState)>0) {
                        end.last = newState;
                    }
                } else {
                    openSet.add(end);
                    end.last = newState;
                }
            }
            closedSet.add(current);
            if (closedSet.contains(target)) {
                return target.last;
            }
        }

        return target.last;
    }
}


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

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Akash Agrawal
 */
public class DWG {
    
    public static void main(String [] args) throws FileNotFoundException, IOException
    {
        Scanner scan= new Scanner(new File("inp.txt"));
        
        int n=scan.nextInt();
        //System.out.println(n);
        int cas=1;
        while(n--!=0)
        {
            int t=scan.nextInt();
            int s=scan.nextInt();
            int p=3*scan.nextInt();
            
            int count =0;
            for(int i=0;i<t;i++)
            {
                int temp = scan.nextInt();
                //System.out.println(temp);
                if(temp == 0 )continue;
                else if(temp==1 && p==1) count++; 
                if(temp>=p-2)count++;
                else if(temp>=p-4 && s>0 )
                {count++;s--;}
                
            }
            
            System.out.println("Case #"+cas+++": "+count);
            
        }
        }
    
}
