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.util.ArrayList;
import java.util.List;

public class ProblemSample implements Problem {

    private int solution;

    private int googlers;

    private int surprises;

    private int note;

    private List<Integer> sums = new ArrayList<Integer>();

    @Override
    public void solve() {

        int resultat = 0;

        for (int i = 0; i < sums.size(); i++) {

            if (note == 0) {
                // Ils ont tous eu au moins 0...
                resultat = this.googlers;
            } else if (note == 1) {
                // Tous ceux qui ont eu au moins 1 ont eu au moins la note de 1.
                if (sums.get(i) >= 1) {
                    resultat++;
                }
            } else {
                if ((sums.get(i) == 3 * note - 4 || sums.get(i) == 3 * note - 3) && sums.get(i) > note) {
                    // S'ils sont tout juste, ils ont utilisÃ© une surprise.
                    surprises--;
                    // Et on les compte que si il restait des surprises Ã  consommer
                    if (surprises >= 0) {
                        resultat++;
                    }
                }
                if (sums.get(i) >= 3 * note - 2 && sums.get(i) > note) {
                    // Ok sans surprise.
                    resultat++;
                }
            }
        }
        this.setSolution(resultat);
    }

    @Override
    public void print() {
        System.out.println(googlers + " " + surprises + " " + note + " " + sums.toString());
    }

    @Override
    public Object getSolution() {
        return solution;
    }

    public void setSolution(int solution) {
        this.solution = solution;
    }

    public int getGooglers() {
        return googlers;
    }

    public int getSurprises() {
        return surprises;
    }

    public int getNote() {
        return note;
    }

    public List<Integer> getSums() {
        return sums;
    }

    public void setGooglers(int googlers) {
        this.googlers = googlers;
    }

    public void setSurprises(int surprises) {
        this.surprises = surprises;
    }

    public void setNote(int note) {
        this.note = note;
    }

    public void setSums(List<Integer> sums) {
        this.sums = sums;
    }

}