Marisa wants to run a sweep line algorithm on a set of points. In a sweep line algorithm, the point with the lowest x-value gets processed first, then the 2nd lowest x, then the 3rd, until the point with the highest x gets processed. If 2 points have the same x-value, then they the point with the lower y-value is processed first.
Marisa wonders how the order would change if all the points are rotated. If she rotates all points around the origin by degrees counterclockwise, what would be the x-value (after rotation) of the last point processed by a sweep line algorithm?
Since Marisa is studious, she has many values of for which she wants the x-value of last point processed.
Input
The first line has 2 integers, ,
, the number of points, and the number of values of
The next lines each have 2 integers,
, the x and y value of the ith point. All points are distinct.
The next lines have one value,
, a float which gives the amount in degrees the points are rotated by. Each value of
represents an independent case, so do not apply rotations successively.
Output:
For every value of , write one line with the answer for that query. The answer being the last x-value processed if the original points were rotated by
degrees counterclockwise.
Sample Input:
3
0 0
1 1
0 1
Sample Output:
0.2928931713
Sample Input:
4
1 1
3 1
3 4
1 4
Sample Output:
2
Sample Input:
5
0 0
1 0
1 1
0 2
-1 1
Sample Output:
0.1291712523
Comments