import java.util.Scanner;
public class B {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		for(int zz = 1; zz <= T;zz++){
			int N = in.nextInt();
			int S = in.nextInt();
			int p = in.nextInt();
			int x = 0;
			for(int i = 0; i < N;i++){
				int score = in.nextInt();
				int best = score/3;
				int mod = score%3;
				int diff = p-best;
				if(diff<1){
					x++;
				}else if(diff<2){
					if(mod==0 && score !=0){
						if(S!=0){
							S--;x++;
						}
					}else if(score!=0){
						x++;
					}
				}else if(diff<3){
					if(mod==2){
						if(S!=0){
							S--;x++;
						}
					}
				}
			}
			System.out.format("Case #%d: %d\n", zz, x);
		}
	}
}

   import java.io.*;
   import java.util.*;
   public class dancing
   {
      public static void main(String[] args) throws Exception
      {
         BufferedReader reader = new BufferedReader(new FileReader("B-large.in"));
         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("B-large.out")));
         int cases = Integer.parseInt(reader.readLine());
         for(int x = 0; x < cases; x++)
         {
            int count = 0;
            String next = reader.readLine();
            StringTokenizer token = new StringTokenizer(next);
            int N = Integer.parseInt(token.nextToken()); 
            int S = Integer.parseInt(token.nextToken());
            int p = Integer.parseInt(token.nextToken());
            int[] array = new int[N];
            for(int y = 0; y < N; y++)
               array[y] = Integer.parseInt(token.nextToken());
            for(int y = 0; y < N; y++)
            {
               if(array[y] == 0 && p != 0){
               }
               else if(array[y] >= 28)
               {
                  if(p <= 10)
                     count++;
               }
               else if(array[y]%3 == 1)
               {
                  if(array[y]/3 + 1 >= p)
                     count++;
               }
               else if(array[y]%3 == 2)
               {
                  if(array[y]/3 + 1 >= p)
                     count++;
                  else if(array[y]/3 + 2 >= p)
                     if(S > 0)
                     {
                        S--;
                        count++;
                     }
               }
               else if(array[y]%3 == 0)
                  if(array[y]/3 >= p)
                     count++;
                  else if(array[y]/3 + 1 >= p)
                     if(S > 0)
                     {
                        S--;
                        count++;
                     }
            }
            out.println("Case #" + (x + 1) + ": " + count);
         }
         out.close();
      }
   }