A mad dangerous bull has freed himself from its chain. Now it's attacking all people that come by in its path. So, the people of the village 'Goru Mari' are frightened and at a loss. One of the villagers reported that the bull is sitting in a place (actually after all days of hard work, the bull was resting). So, the villagers made a plan to imprison the cow with a fence.
Assume the village as a 2D grid, where the bull is sitting on coordinate (x, y). And some pairs of coordinates will be given (x1, y1), (x2, y2), that means the villagers can put bamboos between this two points. Actually there is a tree in (x1, y1) and also one in (x2, y2), and there are branches in the trees such that the villagers can tie two bamboos so that the bull won't be able to cross. The villagers are not able to place bamboos between trees which are not listed (may be, there are no suitable branches in those trees such that a bamboo can be tied).
Now the villagers want to imprison the bull, which means they want to use some bamboos to cover an area such that the bull will be inside that area and not able to cross that area. The villagers want the area to be convex. That means each angle is less than or equal to 180 degree. If there is a bamboo position that crosses any other bamboo position, then only one of them can be used.
Since bamboos are not so cheap, so the villagers want to imprison the bull such that the total length of the bamboo is as small as possible. And villagers are not good at math, so they asked your help.
Input
Input starts with an integer T (≤ 125), denoting the number of test cases.
Each case starts with a blank line. The next line contains three integers n x y where n (1 ≤ n ≤ 100) denotes the number of tree pairs, (x, y) means the position of the bull. Each of the next n lines contains four integers x1 y1 x2 y2, meaning that you can place bamboos between (x1, y1) and (x2, y2). You can assume that all the co-ordinates given for this problem satisfy (-104 ≤ xi, yi ≤ 104) and no two trees and the position of the bull will be collinear.
Output
For each case, print the case number and the minimum length of the bamboos needed. If no such solution is found, print -1. Errors less than 10-6 will be ignored.
Sample
Sample Input | Sample Output |
---|---|
2 3 2 1 0 0 10 0 10 0 0 10 0 10 0 0 1 5 5 0 0 10 0 | Case 1: 68.2842712475 Case 2: -1.000 |