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