#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <complex>
#include <cmath>
using namespace std;

typedef pair<double,double> pdd;
typedef complex<double> P;
typedef const P &rP;

#define EPS 1e-8

double dot(rP a, rP b){
	return real(a) * real(b) + imag(a) * imag(b);
}

double cross(rP a, rP b){
	return real(a) * imag(b) - imag(a) * real(b);
}

bool contains(const vector<P> &plg, rP p){
	int c = 0;
	double y = imag(p);
	
	for(int i = 1; i < plg.size(); ++i){
		double dy1 = imag(plg[i]) - y;
		double dy2 = y - imag(plg[i-1]);
		double tx = (dy1 * real(plg[i-1]) + dy2 * real(plg[i])) / (dy1 + dy2);

		if(imag(plg[i]) >= y && imag(plg[i-1]) < y){
			if(tx < real(p)){ ++c; }
		}
		else if(imag(plg[i]) < y && imag(plg[i-1]) >= y){
			if(tx < real(p)){ ++c; }
		}
	}
	
	return c % 2 != 0;
}

vector<P> intrlc(rP p1, rP p2, rP pc, double r){
	P v12 = p2 - p1, v1c = pc - p1;
	vector<P> ret;
	double a = norm(v12);
	double b = dot(v12, v1c);
	double c = norm(v1c) - r * r;
	double D = b * b - a * c;
	if(D >= 0.0){
		D = sqrt(D);
		double t1 = (b + D) / a, t2 = (b - D) / a;
		if(-EPS < t1 && t1 < 1.0 + EPS){
			ret.push_back(p1 + v12 * t1);
		}
		if(-EPS < t2 && t2 < 1.0 + EPS){
			ret.push_back(p1 + v12 * t2);
		}
	}
	return ret;
}

pdd intrll(rP pa1, rP pa2, rP pb1, rP pb2){
	P da12 = pa2 - pa1;
	P db21 = pb1 - pb2;
	P dab1 = pb1 - pa1;
	double D = cross(da12, db21);
	if(abs(D) < EPS){ return pdd(-1e300, -1e300); }
	return pdd(cross(dab1, db21) / D, cross(da12, dab1) / D);
}

int main(){
	double pi = acos(-1.0);

	int n, x, y;
	double r;
	scanf("%d%lf", &n, &r);
	
	vector<P> plg(n + 1);
	vector<double> args(1, 0.0);
	for(int i = 0; i < n; ++i){
		scanf("%d%d", &x, &y);
		plg[i] = P(x, y);
		if(x != 0 || y != 0){
			args.push_back(arg(plg[i]));
		}
	}
	plg[n] = plg[0];

	for(int i = 1; i < plg.size(); ++i){
		for(double j = 1.0; j <= r + EPS; j += 1.0){
			vector<P> res = intrlc(plg[i-1], plg[i], P(), j);
			for(int k = 0; k < res.size(); ++k){
				args.push_back(arg(res[k]));
			}
		}
	}

	sort(args.begin(), args.end());
	args.erase(unique(args.begin(), args.end()), args.end());
	args.push_back(args[0] + 2.0 * pi);

	double ans = 0.0;
	for(int i = 1; i < args.size(); ++i){
		double mid = 0.5 * (args[i-1] + args[i]);
		P d1 = polar(1.0, args[i-1]);
		P d2 = polar(1.0, mid);
		P d3 = polar(1.0, args[i]);

		vector<pdd> ev;
		for(double j = 1.0; j <= r + EPS; j += 1.0){
			ev.push_back(pdd(j, 0.5 * j * j * (args[i] - args[i-1])));
		}
		for(int j = 1; j < plg.size(); ++j){
			pdd t = intrll(P(), d2, plg[j-1], plg[j]);
			if(t.first > EPS && t.first < r){
				if(t.second > -EPS && t.second < 1.0 + EPS){
					P dif = plg[j-1] - plg[j];
					
					double u1 = intrll(plg[j], plg[j-1], P(), d1).first;
					double u2 = intrll(plg[j], plg[j-1], P(), d3).first;
					
					P a = plg[j] + u1 * dif;
					P b = plg[j] + u2 * dif;
					ev.push_back(pdd(t.first, 0.5 * abs(cross(a, b))));
				}
			}
		}
		
		if(contains(plg, polar(EPS, mid))){
			ev.push_back(pdd(0.0, 0.0));
		}
		
		sort(ev.begin(), ev.end());

		double S = 0.0;
		bool add = false;
		for(int j = 0; j < ev.size(); ++j){
			if(add){
				S += ev[j].second;
			}
			else if(j + 1 < ev.size()){
				S -= ev[j].second;
			}
			add = !add;
		}

		ans += S;
	}
	
	printf("%.15f\n", ans);
}

Measured memory_bytes: 1400