import java.util.*;
import java.io.*;

public class DancingWithTheGooglers
{
    public DancingWithTheGooglers()
    {
        Scanner inFile = null;
        try
        {
            inFile = new Scanner(new File("inputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening input file. Exiting...");
			System.exit(0);
        }
        int t = inFile.nextInt();
        
        int [] results = new int [t];
        DancingWithTheGooglersMax [] rnc = new DancingWithTheGooglersMax[t];
        
        int i, j;
        int [] scores;
        int s, p;
        for(i = 0; i < t; i++)
        {
            scores = new int [inFile.nextInt()];
            s = inFile.nextInt();
            p = inFile.nextInt();
            for(j = 0; j < scores.length; j++)
                scores[j] = inFile.nextInt();
            
            rnc[i] = new DancingWithTheGooglersMax(i, scores, s, p, results);
            rnc[i].start();
        }
        inFile.close();
        
        boolean done = false;
        
        while(!done)
        {
            done = true;
            for(i = 0; i < t; i++)
                if(rnc[i].isAlive())
                {
                    done = false;
                    break;
                }
        }
        
        PrintWriter outFile = null;
        try
        {
            outFile = new PrintWriter(new File("outputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening output file. Exiting...");
			System.exit(0);
        }
        
        for(i = 0; i < results.length; i++)
            outFile.printf("Case #%d: %d\n", i+1, results[i]);
        outFile.close();
    }
    
    public static void main(String [] args)
    {
        new DancingWithTheGooglers();
    }
    
    private class DancingWithTheGooglersMax extends Thread
    {
        int id;
        int s, p;
        int [] results, scores;
        
        public DancingWithTheGooglersMax(int i, int [] aScores, int aS, int aP,int [] res)
        {
            id = i;
            s = aS;
            p = aP;
            results = res;
            scores = aScores;
        }
        
        public void run()
        {
            int a = 0, b = 0;
            
            if(p == 0)
                results[id] = scores.length;
            else if(p == 1)
            {
                int y;
                y = 3*p - 3;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > 0)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
            else
            {
                int y, z;
                y = 3*p - 3;
                z = 3*p - 5;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > z)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
        }
    }
}
import java.util.*;

public class B {
	public static void main (String [] args) {
				
		Scanner s = new Scanner(System.in);
		int T = s.nextInt();
		
        int[] normalBestScores = new int[]{
            0, //0: (0, 0, 0)
            1, //1: (1, 0, 0)
            1, //2: (1, 1, 0)
            1, //3: (1, 1, 1)
            2, //4: (2, 1, 1)
            2, //5: (2, 2, 1)
            2, //6: (2, 2, 2)
            3, //7: (3, 2, 2)
            3, //8: (3, 3, 2)
            3, //9: (3, 3, 3)
            4, //10: (4, 3, 3)
            4, //11: (4, 4, 3)
            4, //12: (4, 4, 4)
            5, //13: (5, 4, 4)
            5, //14: (5, 5, 4)
            5, //15; (5, 5, 5)
            6, //16: (6, 5, 5)
            6, //17: (6, 6, 5)
            6, //18: (6, 6, 6)
            7, //19: (7, 6, 6)
            7, //20: (7, 7, 6)
            7, //21: (7, 7, 7)
            8, //22: (8, 7, 7)
            8, //23: (8, 8, 7)
            8, //24: (8, 8, 8)
            9, //25: (9, 8, 8)
            9, //26: (9, 9, 8)
            9, //27: (9, 9, 9)
            10, //28: (10, 9, 9)
            10, //29: (10, 10, 9)
            10 //30: (10, 10, 10)
        };
        
        int[] surpriseBestScores = new int[] {
            -1, //0: None
            -1, //1: None
            2, //2: (2, 0, 0)
            2, //3: (2, 1, 0)
            2, //4: (2, 2, 0)
            3, //5: (3, 1, 1)
            3, //6: (3, 2, 1)
            3, //7: (3, 3, 1)
            4, //8: (4, 2, 2)
            4, //9: (4, 3, 2)
            4, //10: (4, 4, 2)
            5, //11: (5, 3, 3)
            5, //12: (5, 4, 3)
            5, //13: (5, 5, 3)
            6, //14: (6, 4, 4)
            6, //15: (6, 5, 4)
            6, //16: (6, 6, 4)
            7, //17: (7, 5, 5)
            7, //18: (7, 6, 5)
            7, //19: (7, 7, 5)
            8, //20: (8, 6, 6)
            8, //21: (8, 7, 6)
            8, //22: (8, 8, 6)
            9, //23: (9, 7, 7)
            9, //24: (9, 8, 7)
            9, //25: (9, 9, 7)
            10, //26: (10, 8, 8)
            10, //27: (10, 9, 8)
            10, //28: (10, 10, 8)
            -1, //29: None
            -1 //30: None
        };
        
		for (int t = 1; t <= T; t++) {
			int N = s.nextInt();
            int S = s.nextInt();
            int p = s.nextInt();
            int[] tp = new int[N];
            for (int i = 0; i < N; i++)
                tp[i] = s.nextInt();
			Arrays.sort(tp);
            int ans = 0;
            for (int i = N-1; i >= 0; i--) {
                if (normalBestScores[tp[i]] >= p) {
                    ans++;
                } else if (S > 0 && tp[i] >= 2 && tp[i] <= 28) {
                    S--;
                    if (surpriseBestScores[tp[i]] >= p) {
                        ans++;
                    }
                }            
            }
            
			System.out.println("Case #" + t + ": "+ans);
		}
	}
}