B. Rolling The Polygon
time limit per test
10 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Bahiyyah has a convex polygon with $$$n$$$ vertices $$$P_0, P_1, \cdots, P_{n-1}$$$ in the counterclockwise order. Two vertices with consecutive indexes are adjacent, and besides, $$$P_0$$$ and $$$P_{n-1}$$$ are adjacent. She also assigns a point $$$Q$$$ inside the polygon which may appear on the border.

Now, Bahiyyah decides to roll the polygon along a straight line and calculate the length of the trajectory (or track) of point $$$Q$$$.

To help clarify, we suppose $$$P_n = P_0, P_{n+1} = P_1$$$ and assume the edge between $$$P_0$$$ and $$$P_1$$$ is lying on the line at first. At that point when the edge between $$$P_{i-1}$$$ and $$$P_i$$$ lies on the line, Bahiyyah rolls the polygon forward rotating the polygon along the vertex $$$P_i$$$ until the next edge (which is between $$$P_i$$$ and $$$P_{i+1}$$$) meets the line. She will stop the rolling when the edge between $$$P_n$$$ and $$$P_{n+1}$$$ (which is same as the edge between $$$P_0$$$ and $$$P_1$$$) meets the line again.

Input

The input contains several test cases, and the first line is a positive integer $$$T$$$ indicating the number of test cases which is up to $$$50$$$.

For each test case, the first line contains an integer $$$n~(3\le n \le 50)$$$ indicating the number of vertices of the given convex polygon. Following $$$n$$$ lines describe vertices of the polygon in the counterclockwise order. The $$$i$$$-th line of them contains two integers $$$x_{i-1}$$$ and $$$y_{i-1}$$$, which are the coordinates of point $$$P_{i-1}$$$. The last line contains two integers $$$x_Q$$$ and $$$y_Q$$$, which are the coordinates of point $$$Q$$$.

We guarantee that all coordinates are in the range of $$$-10^3$$$ to $$$10^3$$$, and point $$$Q$$$ is located inside the polygon or lies on its border.

Output

For each test case, output a line containing Case #x: y, where x is the test case number starting from $$$1$$$, and y is the length of the trajectory of the point $$$Q$$$ rounded to $$$3$$$ places. We guarantee that $$$4$$$-th place after the decimal point in the precise answer would not be $$$4$$$ or $$$5$$$.

Example
Input
4
4
0 0
2 0
2 2
0 2
1 1
3
0 0
2 1
1 2
1 1
5
0 0
1 0
2 2
1 3
-1 2
0 0
6
0 0
3 0
4 1
2 2
1 2
-1 1
1 0
Output
Case #1: 8.886
Case #2: 7.318
Case #3: 12.102
Case #4: 14.537