import java.util.*;
public class Test {
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int T = in.nextInt();

    for(int i = 1; i<=T; i++) {
      int n = in.nextInt();
      int s = in.nextInt();
      int p = in.nextInt();
      int result = 0;
      for(int j = 0; j<n; j++){
        int x = canAddUp(in.nextInt(), p);
        if(x == 0) {
          result++;
        } else if (x==1 && s > 0) {
          result++;
          s--;
        }
      }
      System.out.println("Case #"+i+": "+result);
    }
  }

  public static int canAddUp(int sum, int limit) {
    boolean flag = false;
    for(int i = 0; i<=sum; i++) {
      for(int j = 0; i+j <= sum; j++) {
        int k = sum-(i+j);
        int a = Math.abs(i-j);
        int b = Math.abs(i-k);
        int c = Math.abs(j-k);
        if(a > 2 || b > 2 || c> 2){
          continue;
        }

        if (i>=limit || j>=limit || k>=limit) {
          if(a < 2 && b < 2 && c < 2) {
            return 0;
          }else{
            flag = true;
          }
        }
      }
    }
    return (flag) ? 1 : 2;
  }
}

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

public class r2a
{

	int surprises = 0;
	int p = 0;
	int elems[] = new int[100];
    int output = 0;

    /**
     * @param args
     */
    public static void main(String[] args)
    {
        r2a mk = new r2a();
        try {
            FileInputStream fstream = new FileInputStream("d:/cjinput.txt");
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String str;
            int i = 0;
            while ((str = br.readLine()) != null) {
            	int numOfElems = 0;
            	mk.output = 0;
                i++;
                if (i == 1)
                    continue;
                StringTokenizer strTok = new StringTokenizer(str, " ");
                while (strTok.hasMoreTokens()) {
                	numOfElems =  Integer.parseInt(((String) strTok.nextToken()));
                    mk.surprises = Integer.parseInt(((String) strTok.nextToken()));
                    mk.p = Integer.parseInt(((String) strTok.nextToken()));
                    for (int x = 0; x < numOfElems; x++) {
                        mk.elems[x] = Integer.parseInt(((String) strTok.nextToken()));
                    }
                }

                mk.evaluate(i,numOfElems);

            }
            in.close();
        }
        catch (Exception e) {
            System.err.println(e);
        }

    }

    private void evaluate(int rowNum, int numOfElems)
    {
    	
    	for (int i = 0; i< numOfElems; i++) {
    		if (isValidTotal(elems[i])) 
    			output++;
    		
    	}

        String outputStr = "Case #" + (rowNum -1) + ": " + output;
        System.out.println(outputStr);
    }

	private boolean isValidTotal(int num) {
		
		if (p==0)
			return true;
		if (num != 0) {
			int maxVal = 3*p;
			if (num >= maxVal-2)
				return true;
			if (num >= maxVal-4 && surprises > 0) {
				surprises--;
				return true;
			}
		}
		return false;
	}
}
