Problem: Magic Circle

Problem Statement

~ How to draw a magic circle ~

1. Prepare a sufficiently large and white floor.
2. Draw a circle with radii 1, 2, ..., R centered on the point at the floor coordinates (0,0).
3. 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.
4. Draw a polygon with N vertices on the floor.
5. 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.

<image>

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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SZ(a) ((int)(a.size()))

typedef long long ll;
typedef pair<int, int> PI;

typedef complex<double> P;
typedef pair<P, double> C;
typedef vector<P> poly;
const double EPS = 1e-9;

#define EQ(a, b) (abs((a)-(b)) < EPS)

double dot(P a, P b){
  return real(conj(a) * b);
};

double cross(P a, P b){
  return imag(conj(a) * b);
};


vector<double> roots(double a, double b, double c){
  double scale = abs(a) + abs(b) + abs(c);
  auto D = b * b - 4 * a *c;
  vector<double> x;
  if(D < -EPS*scale) return x;
  if(D<EPS*scale) return vector<double>(1,-b/2/a);
  if(b<0){
    x.pb((-b+sqrt(D))/2/a);
  }else{
    x.pb((-b-sqrt(D))/2/a);
  }
  
  x.pb(c/a/x.front());
  return x;
}



double area_of_intersection(const C c , const poly v){
  double r = c.second;
  P z = c.first;
  double res = 0;
  rep(i, SZ(v)){
    P p = v[i] - z, q = v[(i +1)%SZ(v)] - z;
    P v = q - p;
    auto t = roots(norm(v), 2*dot(p, v), norm(p)-r*r);
    sort(ALL(t));
    if(!t.empty() && (t.back()<0||t.front()>1)) t.clear();
    t.insert(t.begin(),0);
    t.pb(1);
    rep(i,SZ(t)-1){
      P a = p + t[i] * v, b = p + t[i+1]*v;
      if(EQ(a, 0.) || EQ(b, 0.)) continue;
      P m = (a + b) * .5;
      res += abs(m) <= r + EPS ? cross(a, b) : r * r * arg(b/ a);
    }
  }
  return abs(res) * .5;
}

int n, r;
double x[100], y[100];

void solve(){
  rep(i, n) cin >> x[i] >> y[i];

  poly po;
  rep(i, n) po.pb(P(x[i], y[i]));
  double ans = 0;
  for(int i = 0; i < r; ++i){
    double small = area_of_intersection(C(P(0, 0), i), po);
    double big = area_of_intersection(C(P(0, 0), (i + 1)), po);
    if(i & 1){
      const double pi = acos(-1);
      ans += pi * (2 * i + 1);
      ans -= big - small;
    }else{
      ans += big - small;
    }
  }

  printf("%.18f\n", ans);
}

int main(int argc, char *argv[])
{
  while(cin >> n >> r && n) solve();
  return 0;
}