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;
  }
}

package jp.funnything.competition.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;

public class Packer {
    private static void add( final ZipArchiveOutputStream out , final File file , final int pathPrefix ) {
        if ( file.isDirectory() ) {
            final File[] children = file.listFiles();

            if ( children.length > 0 ) {
                for ( final File child : children ) {
                    add( out , child , pathPrefix );
                }
            } else {
                addEntry( out , file , pathPrefix , false );
            }
        } else {
            addEntry( out , file , pathPrefix , true );
        }
    }

    private static void addEntry( final ZipArchiveOutputStream out , final File file , final int pathPrefix , final boolean isFile ) {
        try {
            out.putArchiveEntry( new ZipArchiveEntry( file.getPath().substring( pathPrefix ) + ( isFile ? "" : "/" ) ) );

            if ( isFile ) {
                final FileInputStream in = FileUtils.openInputStream( file );
                IOUtils.copy( in , out );
                IOUtils.closeQuietly( in );
            }

            out.closeArchiveEntry();
        } catch ( final IOException e ) {
            throw new RuntimeException( e );
        }
    }

    public static void pack( final File source , final File destination ) {
        try {
            final ZipArchiveOutputStream out = new ZipArchiveOutputStream( destination );

            add( out , source , FilenameUtils.getPath( source.getPath() ).length() );

            out.finish();
            out.close();
        } catch ( final IOException e ) {
            throw new RuntimeException( e );
        }
    }
}
