// Arup Guha
// 7/6/2013
// Solution to 2013 World Finals Problem J: Pollution Solution

// The basic technique here is to find all critical x points, and then add up the areas in between
// each critical x point.

// Within one interval, we must look at all non-vertical sub-segments, and sort them by y value.
// We are traversing in and out of the polygon as we step through these. We must ignore all lines
// below the x-axis. Then we add up each trapezoid inside the polygon we see. Finally, the last
// area to add might have a circle on top and a line segment on bottom, we can just do an integral
// (I did a trig sub, but it's probably in some table...) to find this area. You have to be careful
// that the bottom line isn't below the X-axis.

import java.util.*;

public class pollution {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int n = stdin.nextInt();
		int r = stdin.nextInt();

		// Read in points.
		pt[] poly = new pt[n];
		for (int i=0; i<n; i++) {
			int x = stdin.nextInt();
			int y = stdin.nextInt();
			poly[i] = new pt(x,y);
		}

		// For line segments.
		lineseg[] lines = new lineseg[n];
		for (int i=0; i<n; i++)
			lines[i] = new lineseg(poly[i], poly[(i+1)%n]);

		// Create list of critical X values.
		ArrayList<Double> criticalX = new ArrayList<Double>();
		criticalX.add(-(double)r);
		criticalX.add((double)r);
		for (int i=0; i<n; i++)
			criticalX.add(poly[i].x);

		// Add in all intersections with circle and x-axis.
		for (int i=0; i<n; i++) {
			ArrayList<Double> temp = lines[i].intCircle(r);
			for (int j=0; j<temp.size(); j++)
				criticalX.add(temp.get(j));

			Double xAxis = lines[i].intXAxis();
			if (xAxis != null) criticalX.add(xAxis);
		}

		// Remove repeats and values out of range.
		double[] xPts = fix(criticalX, r);

		// Solve and print.
		System.out.println(solve(xPts, lines, r));
	}

	// Solves the given query.
	public static double solve(double[] xPts, lineseg[] lines, double r) {

		double area = 0;

		// Go through each critical interval.
		for (int i=0; i<xPts.length-1; i++) {

			double midX = (xPts[i]+xPts[i+1])/2;
			double circleMdY = Math.sqrt(r*r - midX*midX);

			// Put in all polygon segments within this interval.
			ArrayList<lineseg> myLines = new ArrayList<lineseg>();
			for (int j=0; j<lines.length; j++) {

				if (lines[j].isVertical()) continue;

				double t1 = lines[j].getT(xPts[i]);
				double t2 = lines[j].getT(xPts[i+1]);

				// This segment exists in the interval, so add it.
				if (t1 >= 0 && t1 <=1 && t2 <= 1 && t2 >= 0)
					myLines.add(new lineseg(lines[j].getPt(t1), lines[j].getPt(t2)));
			}

			// Allows us to go through these in order.
			Collections.sort(myLines);
			for (int j=0; j<myLines.size(); j++) {

				// Not in water...
				if (myLines.get(j).getMidPtY() < 0) continue;

				// This line is above the circle, see if we're in the poly and get out.
				if (myLines.get(j).getMidPtY() > circleMdY) {
					if (j%2 == 1)
						area += getCircleArea(myLines.get(j-1), xPts[i], xPts[i+1], r);
					break;
				}

				// Add in if we're in the poly.
				if (j%2 == 1)
					area += (myLines.get(j).s.y-myLines.get(j-1).s.y+myLines.get(j).e.y-myLines.get(j-1).e.y)*(xPts[i+1]-xPts[i])/2;
			}
		}

		return area;
	}

	// Returns the area between the circle designated by [x1,x2] and r and either the x-axis or bottom,
	// which ever is higher.
	public static double getCircleArea(lineseg bottom, double x1, double x2, double r) {

		double theta1 = Math.acos(x1/r);
		double theta2 = Math.acos(x2/r);
		double circleInt = f(r, theta2) - f(r, theta1);

		// Line below is not in the water.
		if (bottom.getMidPtY() < 0) return circleInt;

		// Subtract out the trapezoid below and return!
		double trap = (bottom.s.y+bottom.e.y)*(x2-x1)/2;
		return circleInt - trap;
	}

	public static double f(double r, double angle) {
		return r*r/2*(Math.sin(2*angle)/2-angle);
	}

	public static double[] fix(ArrayList<Double> list, double r) {

		Collections.sort(list);

		ArrayList<Double> ans = new ArrayList<Double>();

		// Try each value in order.
		for (int i=0; i<list.size(); i++) {

			double val = list.get(i);

			// Don't add if out of range or not a new value.
			if (val < -r || val > r) continue;
			if (ans.size() > 0 && val - ans.get(ans.size()-1) < 1e-9) continue;

			// This is a valid, unique value.
			ans.add(val);
		}

		// Copy into an array, and return.
		double[] array = new double[ans.size()];
		for (int i=0; i<array.length; i++)
			array[i] = ans.get(i);

		return array;
	}

}

class pt {

	public double x;
	public double y;

	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}

	public pt add(vect myv) {
		return new pt(x+myv.dx, y+myv.dy);
	}

	public String toString() {
		return x+","+y;
	}
}

class vect {

	public double dx;
	public double dy;

	public vect(double mydx, double mydy) {
		dx = mydx;
		dy = mydy;
	}

	public vect(pt start, pt end) {
		dx = end.x - start.x;
		dy = end.y - start.y;
	}
}

class lineseg implements Comparable<lineseg> {

	public pt s;
	public pt e;
	public vect v;

	public lineseg(pt pt1, pt pt2) {
		s = pt1;
		e = pt2;
		v = new vect(pt1, pt2);
	}

	public lineseg(pt pt1, vect myv) {
		s = pt1;
		e = pt1.add(myv);
		v = myv;
	}

	public String toString() {
		return s+" : "+e;
	}

	// Only call if s.x and e.x of other matches this object.
	public int compareTo(lineseg other) {
		double diff = (s.y+e.y)/2 - (other.s.y+other.e.y)/2;
		if (diff < -1e-9) return -1;
		if (Math.abs(diff) < 1e-9) return 0;
		return 1;
	}

	public double getX(double t) {
		return s.x + t*v.dx;
	}

	public double getY(double t) {
		return s.y + t*v.dy;
	}

	public pt getPt(double t) {
		return new pt(getX(t), getY(t));
	}

	public double getMidPtY() {
		return (s.y+e.y)/2;
	}

	public boolean isVertical() {
		return Math.abs(v.dx) < 1e-9;
	}

	// Precondition: this object must not be a vertical line segment.
	public double getT(double myx) {
		return (myx - s.x)/(v.dx);
	}

	public ArrayList<Double> intCircle(double r) {

		double a = v.dx*v.dx + v.dy*v.dy;
		double b = 2*s.x*v.dx + 2*s.y*v.dy;
		double c = s.x*s.x + s.y*s.y - r*r;

		ArrayList<Double> ans = new ArrayList<Double>();

		// Complex roots.
		double disc = b*b - 4*a*c;
		if (disc < 0) return ans;

		// One root.
		if (Math.abs(disc) < 1e-9) {
			double t = -b/(2*a);
			if (t >= 0 && t <= 1 && getY(t) >= 0)
				ans.add(getX(t));
			return ans;
		}

		// Two roots.
		double t1 = (-b + Math.sqrt(disc))/(2*a);
		double t2 = (-b - Math.sqrt(disc))/(2*a);

		if (t1 >= 0 && t1 <= 1 && getY(t1) >= 0) ans.add(getX(t1));
		if (t2 >= 0 && t2 <= 1 && getY(t2) >= 0) ans.add(getX(t2));

		return ans;
	}

	// Returns x value where lineseg intersects X-axis, or null if it doesn't.
	public Double intXAxis() {

		if (s.y > 0 && e.y > 0) return null;
		if (s.y < 0 && e.y < 0) return null;

		return getX(s.y/(s.y-e.y));
	}

}