#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

// #define double long double
typedef complex<double> P;


double cross(const P& a, const P& b) { return imag(conj(a)*b); }
double dot(const P& a, const P& b) { return real(conj(a)*b); }
double angle(const P &a, const P &b) {
  double ret = abs(arg(b)-arg(a));
  return ret>PI ? 2*PI-ret : ret;
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L() { resize(2); }
};
struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};

P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}

vector<P> crosspointLC(const L &l, const C &c) {
  vector<P> ret;
  P center = projection(l, c.p);
  double d = abs(center - c.p);
  double t = sqrt(c.r * c.r - d * d);
  if (isnan(t)) { return ret; }
  P vect = (l[1] - l[0]);
  vect /= abs(vect);
  ret.push_back(center - vect * t);
  ret.push_back(center + vect * t);
  return ret;
}

bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

vector<P> crosspointSC(const L &s, const C &c) {
  vector<P> v = crosspointLC(s,c);
  vector<P> res;
  FOR(it, v) {
    if (intersectSP(s,*it)) res.push_back(*it);
  }
  return res;
}

double intersectAreaTriC(P p, P q, double r) {
  bool f = 0;
  if (abs(p) < EPS || abs(q) < EPS) return 0;
  if (cross(p,q) < 0) {
    swap(p,q);
    f = 1;
  }  
  double a1 = abs(p);
  double a2 = abs(q);
  double res;
  vector<P> v = crosspointSC(L(p,q),C(P(0,0),r));
  if (v.size() == 2) {
    res = abs(cross(v[0],v[1])) + r*r*(angle(p,q)-angle(v[0],v[1]));
  } else if (v.size() == 1) {
    res = 0;
    if (abs(p) > r) res += r*r*angle(p,v[0]);
    else res += abs(cross(p,v[0]));
    if (abs(q) > r) res += r*r*angle(q,v[0]);
    else res += abs(cross(q,v[0]));
  } else {
    res = min(r*r*angle(p,q), abs(cross(p,q)));
  }
  if (f) res = -res;
  assert(!isnan(res));
  return res / 2;
}

double intersectAreaGC(const vector<P> &g, const C &c) {
  double res = 0;
  int n = g.size();
  REP(i,n) {
    double t = intersectAreaTriC(g[i]-c.p,g[(i+1)%n]-c.p,c.r);
    res += t;
  }
  return res;
}

int main() {
  int n,R;
  while(cin >> n >> R) {
    vector<P> poly;
    REP(i,n) {
      P p; cin >> p.real() >> p.imag();
      poly.push_back(p);
    }

    double ans = 0;
    for (int r=1; r<=R; ++r) {
      double t = intersectAreaGC(poly, C(P(0,0),r));
      if (r%2==1) ans += t;
      else if (r<R) ans -= t;
      if (r%2==0) {
        ans += (2*r-1)*PI;
        ans -= t;
      } else if (r<R) {
        ans += t;
      }
    }
    cout << fixed << setprecision(10) << ans << endl;
    // printf("%.10Lf\n", ans);
  }
}

Measured memory_bytes: 1392