package code12.qualification;

import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;

public class B {
	public static String solve(int N, int S, int p, int[] t) {
		
		// 3a 		-> (a, a, a), *(a - 1, a, a + 1)
		// 3a + 1	-> (a, a, a + 1), *(a - 1, a + 1, a + 1)
		// 3a + 2	-> (a, a + 1, a + 1), *(a, a, a + 2)
		
		int numPNoS = 0;
		int numPWithS = 0;
		
		for (int i = 0; i < N; i++) {
			int a = (int)Math.floor(t[i] / 3);
			int r = t[i] % 3;
			
			switch (r) {
			case 0:
				if (a >= p) {
					numPNoS++;
				} else if (a + 1 >= p && a - 1 >= 0) {
					numPWithS++;
				}
				break;
			case 1:
				if (a >= p || a + 1 >= p) {
					numPNoS++;
				}
				break;
			case 2:
				if (a >= p || a + 1 >= p) {
					numPNoS++;
				} else if (a + 2 >= p) {
					numPWithS++;
				}
				break;
			}
		}
		
		return "" + (numPNoS + Math.min(S, numPWithS));
	}

	public static void main(String[] args) throws Exception {
		// file name
		//String fileName = "Sample";
		//String fileName = "B-small";
		String fileName = "B-large";
		
		// file variable
		File inputFile = new File(fileName + ".in");
		File outputFile = new File(fileName + ".out");
		Scanner scanner = new Scanner(inputFile);
		FileWriter writer = new FileWriter(outputFile);

		// problem variable
		int totalCase;
		int N, S, p;
		int[] t;

		// get total case
		totalCase = scanner.nextInt();

		for (int caseIndex = 1; caseIndex <= totalCase; caseIndex++) {
			// get input
			N = scanner.nextInt();
			S = scanner.nextInt();
			p = scanner.nextInt();
			t = new int[N];
			
			for (int i = 0; i < N; i++) {
				t[i] = scanner.nextInt();
			}
			
			String output = "Case #" + caseIndex + ": " + solve(N, S, p, t);
			System.out.println(output);
			writer.write(output + "\n");
		}
		scanner.close();
		writer.close();
	}
}

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

/**
 *
 * @author Joel
 */
import java.io.*;
import java.util.*;
public class GoogleDance
{
    public static void main(String[] args)
    {
        try
        {
            FileWriter output = new FileWriter("C:\\Users\\Joel\\Documents\\CSCI 221\\Netbeans Projects\\Google CodeJam\\src\\B-large.out");
            BufferedWriter out = new BufferedWriter(output);
            FileReader reader = new FileReader("C:\\Users\\Joel\\Documents\\CSCI 221\\Netbeans Projects\\Google CodeJam\\src\\B-large.in");
            BufferedReader in = new BufferedReader(reader);
            ArrayList<Integer> scores = new ArrayList<Integer>();
            int count = 0;
            int t = Integer.parseInt(in.readLine());
            for (int i = 0; i < t; i++)
            {
                StringBuilder nums = new StringBuilder(in.readLine());
                int n = Integer.parseInt(nums.substring(0, nums.indexOf(" ")));
                nums.delete(0, (nums.indexOf(" ") + 1));
                int s = Integer.parseInt(nums.substring(0, nums.indexOf(" ")));
                nums.delete(0, (nums.indexOf(" ") + 1));
                int p = Integer.parseInt(nums.substring(0, nums.indexOf(" ")));
                nums.delete(0, (nums.indexOf(" ") + 1));
                for (int j = 0; j < (n - 1); j++)
                {
                    scores.add(Integer.parseInt(nums.substring(0, nums.indexOf(" "))));
                    nums.delete(0, (nums.indexOf(" ") + 1));
                }
                scores.add(Integer.parseInt(nums.substring(0)));
                Collections.sort(scores);
                int next = 0;
                if (p == 0)
                    count = scores.size();
                else if (p == 1)
                {
                    for (int k : scores)
                        if (k != 0)
                            count++;
                }
                else
                {
                    while (s > 0 && (next != scores.size()))
                    {
                        if (scores.get(next) >= (p + (2 * (p - 2))))
                        {
                            count++;
                            next++;
                            s--;
                        }
                        else
                           next++;
                    }
                    while (next != (scores.size()))
                    {
                        if (scores.get(next) >= (p + (2 * (p - 1))) && next != scores.size())
                        {
                            count++;
                            next++;
                        }
                        else
                            next++;
                    }
                }
                out.write("Case #" + (i + 1) + ": " + count + "\n");
                count = 0;
                next = 0;
                scores.clear();
            }
            out.close();
        }
        catch (IOException e)
        {
            
        }
    }
}
