package dancinggooglers;

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

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

import java.util.*;

public class B
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int test = 1, cases = sc.nextInt();
		int n, s, p, g, score, count, even, extra;

		while(test <= cases)
		{
			count = 0;
			n = sc.nextInt();
			s = sc.nextInt();
			p = sc.nextInt();

			for(g = 0; g < n; g++)
			{
				score = sc.nextInt();
				even = score / 3;
				extra = score - even * 3;

				if(extra > 0)
					even++;

				if(even >= p)
					count++;
				else	if(s > 0)
					{
						score--;
						even = score / 3;
						extra = score - even * 3;

						if(extra > 0)
							even += 2;

						if(even >= p)
						{
							count++;
							s--;
						}
					}
			}

			System.out.println("Case #" + test + ": " + count);

			test++;
		}
	}
}