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.util.*;
public class CodeJam2
{
	public static void main(String[] args) 
	{
		Scanner bc=new Scanner(System.in);
		int testCases=bc.nextInt();
		for(int i=0;i<testCases;i++)
		{	
			int count1=0;	
			int best=0;
			int n=bc.nextInt();
			int a1[]=new int[n];
			int surprise=bc.nextInt();
			int limit=bc.nextInt();
			for(int j=0;j<n;j++)
			{
				a1[j]=bc.nextInt();
			}
			for(int  q=0;q<n;q++)
			{
				/*System.out.println("The value of array is "+a1[q]);
				*/
			}
			int array1[][]=new int[n][3];
			for(int j=0;j<n;j++)
			{
				array1[j][0]=a1[j]/3;
				int t=a1[j]-array1[j][0];
				int data1=t/2;
				int data2=t-data1;
				if(a1[j]!=0)
				{
				if(data1-data2==0)
				{
					if(limit-data1==1)
					{
						if(count1<surprise)
						{
							count1++;
							best++;
							array1[j][1]=data1--;
							array1[j][2]=data2++;
						}
						else
						{
							array1[j][1]=data1;
							array1[j][2]=data2;
						}
					}
					else if (limit-data1==0)
					{
						array1[j][1]=data1;
						array1[j][2]=data2;
						best++;
					}
					else if(limit-data1>1)
					{
						array1[j][1]=data1;
						array1[j][2]=data2;
					}
					else if(limit-data1<0)
					{
						array1[j][1]=data1;
						array1[j][2]=data2;
						best++;
					}
				}
				
				else if((data2-data1)==1)
				{
					if(limit<=data2)
					{
						array1[j][1]=data1;
						array1[j][2]=data2;
						best++;
					}
					else 
					{
						array1[j][1]=data1;
						array1[j][2]=data2;
					}
				}
				}
				else{
					if(limit==0)
					{
						best++;
					}
				}
			}
			System.out.println("Case #"+(i+1)+": " +best);
		}

	}

}
