Problem F

Fear of The Dark

Time Limit: 3 Second

“At night or strolling through the park, fear of the dark.”

 

When Dickenson was walking in a dark road, he noticed that he has been surrounded by N ghosts. So he stopped at the point (x, y) and realized that each ghost is shaped like a line segment. The ghosts are fixed at their positions and they are not moving.  Dickenson was lucky that he was carrying a gun which can shoot “anti-ghost” ray to kill ghosts. But the gun can shoot the ray at a particular angle θ and can shoot at most K shots. The angle θ can’t be less than 1 degree or greater than 180 degree. Whenever he shoots a ray, the ray spreads at the angle ‘θ’ and goes towards infinity and destroying any body parts of the ghosts in its path. A ghost is said to be killed if “anti-ghost” rays destroy its whole body. If there is just a single point on the ghost’s body that is not being destroyed, the ghost is alive. He can shoot to any direction. Note that sometimes he may need several shots at several directions to completely kill a ghost. Given Dickenson’s position (x, y), the maximum shots K and the endpoints of the body of all the ghosts you have to determine the minimum angle which can be used to kill all the ghosts.

 

The above picture shows how the gun works. A shot has been made at the angle ‘θ’ and the ray destroyed some parts of the ghost G1 and then it destroyed the whole body of the ghost G2.

 

Input:

The first line of the input contains X, the number of test cases. Each case starts with four numbers N ( 1 ≤ N ≤ 50 ), K ( 1 ≤ K ≤ 10 ), x and y. Where N is the number of ghosts, K is the maximum number of shots that can be made using the gun, (x, y) is the Cartesian co-ordinate of Dickenson’s position.  Then there will be N lines containing four numbers x1, y1, x2 and y2 describing each ghost’s body. Here (x1, y1) and (x2, y2) are the end points of a ghost’s body. All the co-ordinates in the input file have an absolute magnitude at most 10,000. For no ghost (x1, y1), (x2, y2) and (x, y) will be collinear.

 

Output:

For every test case you have to output one line which contains the minimum angle θ to shoot all the ghosts. You have to output θ to 4 decimal places. Errors less than or equal to ±0.0001 are considered to be correct. If it is impossible to kill all the ghosts then output -1.0000.

 

SAMPLE INPUT

OUTPUT FOR SAMPLE INPUT

1

4 3 0 0

2 2 2 -2

3 3 3 1

4 2 8 2

-6 1 -6 0

45.0000

 

 

Problemsetter: Tasnim Imran Sunny

Special Thanks to: Md. Mahbubul Hasan