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

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
    
/**
 * 
 * @author dannocz
 */
public class InputReader {
    
    public static Input readFile(String filename){
        try {
              
              /*  Sets up a file reader to read the file passed on the command
          77        line one character at a time */
              FileReader input = new FileReader(filename);
              
              /* Filter FileReader through a Buffered read to read a line at a
                 time */
              BufferedReader bufRead = new BufferedReader(input);
              
              String line;    // String that holds current file line
              int count = 0;  // Line number of count 
              ArrayList<String> cases= new ArrayList<String>();
              
              // Read first line
              line = bufRead.readLine();
              int noTestCases=Integer.parseInt(line);
              count++;
              
              // Read through file one line at time. Print line # and line
              while (count<=noTestCases){
                  //System.out.println("Reading. "+count+": "+line);
                  line = bufRead.readLine();
                  cases.add(line);
                  count++;
              }
              
              bufRead.close();
              
              return new Input(noTestCases,cases);
              
          }catch (ArrayIndexOutOfBoundsException e){
              /* If no file was passed on the command line, this expception is
              generated. A message indicating how to the class should be
              called is displayed */
              e.printStackTrace();        
  
          }catch (IOException e){
              // If another exception is generated, print a stack trace
              e.printStackTrace();
          }
        
        return null;
          
      }// end main
    }

import java.io.*;
import java.math.BigInteger;
import java.util.InputMismatchException;

/**
 * @author Malvino Juwono (malvino.juwono@gmail.com)
 * 
 */
public class ProblemB implements Runnable {
	private InputReader in;
	private PrintWriter out;

	public static void main(String[] args) {
		new Thread(new ProblemB()).start();
	}

	public ProblemB() {
		try {
			System.setIn(new FileInputStream("input.txt"));
			System.setOut(new PrintStream(new FileOutputStream("output.txt")));
		} catch (FileNotFoundException e) {
			e.printStackTrace(System.err);
		}
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
	}

	public void run() {
		
        int numTests = in.readInt();
        for (int testNumber = 0; testNumber < numTests; testNumber++) {
			out.print(String.format("Case #%d: ", (testNumber + 1)));

			int numPeople = in.readInt();
			int numSuprise = in.readInt();
			int minScore = in.readInt();
			int[] scores = new int[numPeople];
			
			for (int i = 0; i < numPeople; ++i) {
				scores[i] = in.readInt();
			}
        	
        	int numTopScorers = getNumTopScorers(numPeople, numSuprise, minScore, scores);
        	
        	System.err.println(String.valueOf(numTopScorers));
			out.write(String.valueOf(numTopScorers) + "\n");
        }
		out.close();
	}
	
	private int getNumTopScorers(int numPeople, int numSurprise, int minScore, int[] scores) {
		int numTopScorers = 0;
		
		
		for (int score : scores) {
			int base = score / 3;

			int avgScoreMod = score % 3;
	        if (avgScoreMod == 0) {
				// regular case:
				if (base >= minScore) {
				      numTopScorers++;
				
				// check for numSurprise case:
				} else if (numSurprise > 0 && base > 0 && base + 1 >= minScore) {            
					numTopScorers++;
					numSurprise--;
				}         
	        } else if (avgScoreMod == 1) {
				// regular case:
				if (base >= minScore || base + 1 >= minScore) {
				      numTopScorers++;
				
				// check for numSurprise case:
				} else if (numSurprise > 0 && base + 1 >= minScore) {            
					numTopScorers++;
					numSurprise--;
				}
	        } else if (avgScoreMod == 2) {
				// regular case:
				if (base + 1 >= minScore || base >= minScore) {
				      numTopScorers++;
				
				// check for numSurprise case:
				} else if (numSurprise > 0 && base + 2 >= minScore) {            
					numTopScorers++;
					numSurprise--;
				}
	        }
		}
		
		return numTopScorers;
	}
	
	
	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1000];
		private int curChar, numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
	}
}
