/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 3/3/12
 * Time: 11:00 AM
 * To change this template use File | Settings | File Templates.
 */

import SRMLib.MathLibrary;
import SRMLib.TestSRMLib;
import com.sun.org.apache.bcel.internal.generic.F2D;

import java.io.*;
import java.util.*;
import java.util.zip.Inflater;

public class SRM {
    public static void main(String[] args) throws IOException {
        //TestSRMLib.run();
        codeJam1.main();

        return;
    }
}
class codeJam1 {
    public static void main() throws IOException {
        String inputPath = "E:\\input.txt";
        String outputPath = "E:\\output.txt";
        BufferedReader input = new BufferedReader(new FileReader(inputPath));
        BufferedWriter output = new BufferedWriter(new FileWriter(outputPath));

        String line;
        line = input.readLine();
        int T = Integer.parseInt(line);
        for (int i = 1; i <= T; ++i) {
            line = input.readLine();
            String[] words = line.split(" ");
            int N = Integer.parseInt(words[0]);
            int S = Integer.parseInt(words[1]);
            int p = Integer.parseInt(words[2]);
            int n = 0;
            int res = 0;

            for (int j = 3; j < words.length; ++j) {
                if (p == 0) {
                    res++;
                    continue;
                }

                int t = Integer.parseInt(words[j]);
                if (p == 1) {
                    if (t > 0)
                        res++;
                    continue;
                }
                if (t >= 3 * p - 2)
                    res++;
                else if (t >= 3 * p - 4)
                    n++;
            }

            res += Math.min(n, S);
            output.write("Case #" + i + ": " + res);
            output.newLine();
        }

        input.close();
        output.close();
    }
}

import java.io.*;

public class ProbB 
{
	public static void main (String[] args) throws Exception
	{
		MyInputReader in = new MyInputReader(new FileInputStream("B-small-attempt2.in"));
		PrintWriter pw = new PrintWriter("output.txt");
		int T = in.nextInt();
		for(int q=0; q<T; q++)
		{
			int n = in.nextInt();
			int s = in.nextInt();
			int p = in.nextInt();
			int result = 0;
			int count = 0;
			for(int i=0; i<n; i++)
			{
				int temp = in.nextInt();
				if(temp==0 && p>0)
					continue;
				if(3*p<=temp || 3*p-2==temp || 3*p-1==temp)
					result++;
				else if(count<s && ((3*p-3)==temp || (3*p-4)==temp || (3*p+4)==temp || (3*p+3)==temp))
				{
					result++;
					count++;
				}	
			}
			pw.println("Case #"+(q+1)+": "+result);
			pw.flush();
		}
	}
	
	static class MyInputReader
    {
		final private int BUFFER_SIZE = 1 << 17;
	
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		
		public MyInputReader(InputStream in)
		{
			din = new DataInputStream(in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
	        
	        public String nextString() throws Exception
		{
			StringBuffer sb=new StringBuffer("");
			byte c = read();
			while(c <= '\n') 
				c = read();
			do
			{
			   sb.append((char)c);
			   c=read();
			}
			while(c>'\n');
			
			return sb.toString();
		}
	        
		public String nextWord() throws Exception
		{
			StringBuffer sb=new StringBuffer("");
			byte c = read();
			while(c <= ' ') 
				c = read();
			do
			{
			   sb.append((char)c);
			   c=read();
			}
			while(c>' ');
			
			return sb.toString();
		}
		
		public char nextChar() throws Exception
		{
			byte c=read();
			while(c<=' ') 
				c= read();
			
			return (char)c;
		}
		
		public int nextInt() throws Exception
		{
			int ret = 0;
			byte c = read();
			while(c <= ' ') 
				c = read();
			boolean neg = c == '-';
			if(neg) 
				c = read();
			do
			{
			  	ret = ret * 10 + c - '0';
			 	c = read();
			} 
			while (c > ' ');
			
			if(neg) 
				return -ret;
			
			return ret;
		}
		
		public long nextLong() throws Exception
		{
			long ret = 0;
			byte c = read();
			
			while (c <= ' ') 
				c = read();
			boolean neg = c == '-';
			if(neg) 
				c = read();
			
			do
			{
			  	ret = ret * 10 + c - '0';
			 	c = read();
			} 
			while (c > ' ');
			
			if(neg) 
				return -ret;
			
			return ret;
		}
		
		private void fillBuffer() throws Exception
		{
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if(bytesRead == -1) 
				buffer[0] = -1;
		}
		
		private byte read() throws Exception
		{
			if(bufferPointer == bytesRead) 
				fillBuffer();
			return buffer[bufferPointer++];
		}
    }
}