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 Dancing {
	public static void main( String[] args ) {
		Scanner scan = new Scanner(System.in);
		int cases = scan.nextInt();
		for (int i = 0; i < cases; i++) {
			int count = 0;
			int n = scan.nextInt();
			int s = scan.nextInt();
			int p = scan.nextInt();
			for( int j = 0; j < n; j++) {
				int score = scan.nextInt();
				if( reg(score) >= p ) {
					count++;
				}
				else if( s > 0 && spec(score) >= p ) {
					count++;
					s--;
				}
			}
			System.out.println("Case #" + (i+1) + ": " + count);			
		}
	}
	
	public static int reg(int n) {
		if( n == 0) {
			return 0;
		}
		else if(n == 2 || n == 1) {
			return 1;
		}
		else if( (n%3) == 0) {
			return (n/3);
		}
		else if( (n%3) == 1) {
			return (n/3) + 1;
		}
		else if( (n%3) == 2) {
			return (n/3)+1;
		}
		return 0;
	}
	
	public static int spec(int n) {
		if( n== 0 ) {
			return 0;
		}
		else if(n == 1) {
			return 1;
		}
		else if(n == 2) {
			return 2;
		}
		else if( (n%3) == 0) {
			return (n/3)+1;
		}
		else if( (n%3) == 1) {
			return (n/3) + 1;
		}
		else if( (n%3) == 2) {
			return (n/3)+2;
		}
		return 0;
	}
}
