#D2789. Magical Circle
Magical Circle
Magical Circle
Magic Circle
Problem Statement
~ How to draw a magic circle ~
- Prepare a sufficiently large and white floor.
- Draw a circle with radii 1, 2, ..., R centered on the point at the floor coordinates (0,0).
- Paint blue between the circle with radius 1 and the circle with radius 2, between the circle with radius 3 and the circle with radius 4, ... Do not paint outside the circle with radius R.
- Draw a polygon with N vertices on the floor.
- Repaint the white area inside the polygon with blue and the blue area with white.
It is said that the power of the magic circle becomes stronger as the magic circle contains more blue. Therefore, I would like you to find the area of the blue area included in the magic circle.
The following figure is an example of a magic circle that can be drawn by this procedure.
Constraints
- 3 ≤ N ≤ 100
- 1 ≤ R ≤ 100
- Polygons are included inside or on the circumference of a circle with radius R.
- Polygons do not have self-intersections.
- The vertices of the polygon are given in a counterclockwise order.
Input
Input follows the following format. All given numbers are integers.
N R x_1 y_1 ... x_N y_N
(x_i, y_i) is the i-th vertex of the polygon.
Output
Output the area of the blue area on one line. The output value must have an absolute or relative error of less than 10 ^ {-8} with the true value.
Examples
Input
3 1 0 0 1 0 0 1
Output
0.500000000
Input
3 2 0 0 2 0 0 2
Output
8.995574288
Input
3 2 1 -1 1 1 -2 0
Output
11.123246567
Input
4 3 1 1 -1 1 -1 -1 1 -1
Output
11.707963268
inputFormat
Input
Input follows the following format. All given numbers are integers.
N R x_1 y_1 ... x_N y_N
(x_i, y_i) is the i-th vertex of the polygon.
outputFormat
Output
Output the area of the blue area on one line. The output value must have an absolute or relative error of less than 10 ^ {-8} with the true value.
Examples
Input
3 1 0 0 1 0 0 1
Output
0.500000000
Input
3 2 0 0 2 0 0 2
Output
8.995574288
Input
3 2 1 -1 1 1 -2 0
Output
11.123246567
Input
4 3 1 1 -1 1 -1 -1 1 -1
Output
11.707963268
样例
4 3
1 1
-1 1
-1 -1
1 -1
11.707963268