A Strange Opera House

Yesterday evening, I have dreamed of a strange opera house which is in the form of a simple polygon. I was standing on the stage at (x, y) singing “That’s All I Ask of You” with my girlfriend - that’s our favorite song. The walls can reflect our voice at most k times. The following 4 figures show how our voice is reflected. (a) the opera house (b) our original voice (c) reflecting the voice once (d) reflecting the voice twice Audiences are sitting by the walls. I wonder how many of them could hear our song, either directly or indirectly. Can you tell me? Input The input consists of at most 10 test cases. Each case contains four integers n, k, x and y (3 ≤ n ≤ 50, 0 ≤ k ≤ 5), the number of vertices of the opera house, the maximal number of reflections of our voice, and the location of the stage. The stage will never be on a wall. The following n lines each contain two integers xi and yi, the coordinates of the vertices. The vertices are arranged either clockwise or counterclockwise. The last case is followed by a single zero, which should not be processed. All the coordinates are integers with absolute values not greater than 1000.

2/2 Output For each test case, print the case number and the total length of wall where our voice could arrive, to two decimal places. Sample Input 5 0 100 135 20 200 200 100 300 125 40 10 100 100 8 1 25 15 00 0 20 30 20 30 0 20 0 20 10 10 10 10 0 0 Sample Output Case 1: 469.86 Case 2: 106.67