Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it will go along a circle around this point and will remove all the snow from its path.

Formally, we assume that Peter's machine is a polygon on a plane. Then, after the machine is switched on, it will make a circle around the point to which Peter tied it (this point lies strictly outside the polygon). That is, each of the points lying within or on the border of the polygon will move along the circular trajectory, with the center of the circle at the point to which Peter tied his machine.

Peter decided to tie his car to point P and now he is wondering what is the area of ​​the region that will be cleared from snow. Help him.


-----Input-----

The first line of the input contains three integers — the number of vertices of the polygon n ($3 \leq n \leq 100000$), and coordinates of point P.

Each of the next n lines contains two integers — coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on a common straight line.

All the numbers in the input are integers that do not exceed 1 000 000 in their absolute value.


-----Output-----

Print a single real value number — the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10^{ - 6}. 

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if $\frac{|a - b|}{\operatorname{max}(1, b)} \leq 10^{-6}$.


-----Examples-----
Input
3 0 0
0 1
-1 2
1 2

Output
12.566370614359172464

Input
4 1 -1
0 0
1 2
2 0
1 1

Output
21.991148575128551812



-----Note-----

In the first sample snow will be removed from that area:

 $0$

Source: codeforces | Difficulty: HARD
Tags: Geometry

Sorting


Solutions:
import math

def cross(vecA, vecB):
	return abs(vecA[0] * vecB[1] - vecA[1] * vecB[0])

def l2_norm(pointA, pointB):
	return (pointA[0] - pointB[0]) ** 2 + (pointA[1] - pointB[1]) ** 2

def height5(P, A, B):
	a = l2_norm(A, P)
	b = l2_norm(B, P)
	base = l2_norm(A, B)
	if a >= base + b or b >= base + a:
		return min(a, b)
	else:
		vecA = (A[0] - P[0], A[1] - P[1])
		vecB = (B[0] - P[0], B[1] - P[1])
		area = cross(vecA, vecB)
		h = area * area / base
		return h

def CF613A():
	(N, cx, cy) = list(map(int, input().split()))
	points = [tuple(map(int, input().split())) for _ in range(N)]
	center = (cx, cy)
	distances = [l2_norm(center, point) for point in points]
	max_radius = max(distances)
	min_radius = float('inf')
	for i in range(N):
		height = height5(center, points[i], points[(i + 1) % N])
		min_radius = min(min_radius, height)
	area = math.pi * (max_radius - min_radius)
	return area

def __starting_point():
	res = CF613A()
	print(res)
__starting_point()


def main():
	(n, a, b) = map(int, input().split())
	(l, res) = ([], [])
	for _ in range(n):
		(u, v) = input().split()
		l.append((int(u) - a, int(v) - b))
	(x0, y0) = l[-1]
	for (x1, y1) in l:
		res.append(x1 * x1 + y1 * y1)
		(dx, dy) = (x1 - x0, y1 - y0)
		if (x0 * dx + y0 * dy) * (x1 * dx + y1 * dy) < 0:
			x0 = x0 * y1 - x1 * y0
			res.append(x0 * x0 / (dx * dx + dy * dy))
		(x0, y0) = (x1, y1)
	print((max(res) - min(res)) * 3.141592653589793)
main()


from math import *

def dist(a, b, p):
	xu = b[0] - a[0]
	yu = b[1] - a[1]
	xv = p[0] - a[0]
	yv = p[1] - a[1]
	c1 = xu * xv + yu * yv
	c2 = xu * xu + yu * yu
	(x, y) = (0, 0)
	if c1 <= 0:
		x = a[0] - p[0]
		y = a[1] - p[1]
	elif c2 <= c1:
		x = b[0] - p[0]
		y = b[1] - p[1]
	else:
		x = a[0] + xu * (c1 / c2) - p[0]
		y = a[1] + yu * (c1 / c2) - p[1]
	return x * x + y * y
(n, cx, cy) = map(int, input().split())
pts = [list(map(int, input().split())) for _ in range(n)]
(mini, maxi) = (float('inf'), 0)
for i in range(n):
	(px, py) = pts[i]
	maxi = max((px - cx) ** 2 + (py - cy) ** 2, maxi)
	mini = min(dist(pts[i - 1], pts[i], [cx, cy]), mini)
print((maxi - mini) * pi)


import math

def dot(v1, v2):
	return v1[0] * v2[0] + v1[1] * v2[1]

def cross(v1, v2):
	return v1[0] * v2[1] - v1[1] * v2[0]

def mag(x, y):
	return math.sqrt(x ** 2 + y ** 2)

def main():
	PI = 3.141592653589793
	mags = []
	(n, x0, y0) = map(int, input().split())
	(x, y) = (x0, y0)
	for i in range(n):
		(x_, y_) = map(int, input().split())
		(x_, y_) = (x_ - x0, y_ - y0)
		if i == 0:
			(x1, y1) = (x_, y_)
			(x, y) = (x_, y_)
		mags.append(mag(x_, y_))
		if dot([x, y], [x - x_, y - y_]) * dot([x_, y_], [x_ - x, y_ - y]) > 0:
			mags.append(abs(cross([x, y], [x_ - x, y_ - y])) / mag(x - x_, y - y_))
		(x, y) = (x_, y_)
	if dot([x, y], [x - x1, y - y1]) * dot([x1, y1], [x1 - x, y1 - y]) > 0:
		mags.append(abs(cross([x, y], [x1 - x, y1 - y])) / mag(x - x1, y - y1))
	print((max(mags) ** 2 - min(mags) ** 2) * PI)

def __starting_point():
	main()
__starting_point()


s = input().split()
n = int(s[0])
px = int(s[1])
py = int(s[2])
y = []
x = []
for i in range(n):
	s = input().split()
	x.append(int(s[0]) - px)
	y.append(int(s[1]) - py)
l = []
(x0, y0) = (x[-1], y[-1])
for i in range(n):
	l.append(x[i] * x[i] + y[i] * y[i])
	(dx, dy) = (x[i] - x0, y[i] - y0)
	if (x0 * dx + y0 * dy) * (x[i] * dx + y[i] * dy) < 0:
		x0 = x0 * y[i] - x[i] * y0
		l.append(x0 * x0 / (dx * dx + dy * dy))
	(x0, y0) = (x[i], y[i])
a = 3.141592653589793 * (max(l) - min(l))
print(a)


import math

def Len(w):
	return w[0] * w[0] + w[1] * w[1]
(n, x, y) = input().split(' ')
n = int(n)
x = int(x)
y = int(y)
arr = []
for i in range(0, n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	arr.append([a, b])
r1 = 5000000000000
r2 = -500000000000
for i in range(0, n):
	st = [arr[(i + 1) % n][0] - arr[i][0], arr[(i + 1) % n][1] - arr[i][1]]
	r = [arr[i][0] - x, arr[i][1] - y]
	q = [arr[(i + 1) % n][0] - x, arr[(i + 1) % n][1] - y]
	d = q[0] * r[1] - q[1] * r[0]
	d *= d
	s = d / Len(st)
	if Len(q) - s < Len(st) and Len(r) - s < Len(st):
		r1 = min(r1, s)
		r2 = max(r2, s)
for i in arr:
	s = (x - i[0]) * (x - i[0]) + (y - i[1]) * (y - i[1])
	r1 = min(r1, s)
	r2 = max(r2, s)
print((r2 - r1) * math.pi)


import math

def dotproduct(point1, point2):
	(x1, y1) = point1
	(x2, y2) = point2
	product = x1 * x2 + y1 * y2
	return product

def crossproduct(point1, point2):
	(x1, y1) = point1
	(x2, y2) = point2
	product = x1 * y2 - y1 * x2
	return product

def magnitude(x, y):
	mag = math.sqrt(x ** 2 + y ** 2)
	return mag

def main():
	magnitudes = []
	(n, x0, y0) = map(int, input().split())
	x = x0
	y = y0
	for i in range(n):
		(x2, y2) = map(int, input().split())
		x2 = x2 - x0
		y2 = y2 - y0
		if i == 0:
			x1 = x2
			y1 = y2
			x = x2
			y = y2
		magnitudes.append(magnitude(x2, y2))
		dot1 = dotproduct([x, y], [x - x2, y - y2])
		dot2 = dotproduct([x2, y2], [x2 - x, y2 - y])
		if dot1 * dot2 > 0:
			total = abs(crossproduct([x, y], [x2 - x, y2 - y]) / magnitude(x - x2, y - y2))
			magnitudes.append(total)
		x = x2
		y = y2
	dot3 = dotproduct([x, y], [x - x1, y - y1])
	dot4 = dotproduct([x1, y1], [x1 - x, y1 - y])
	if dot3 * dot4 > 0:
		total1 = abs(crossproduct([x, y], [x1 - x, y1 - y]) / magnitude(x - x1, y - y1))
		magnitudes.append(total1)
	print((max(magnitudes) ** 2 - min(magnitudes) ** 2) * 3.141592653589793)
main()


from math import hypot, pi, copysign

def main():
	(n, a, b) = map(int, input().split())
	(l, res) = ([], [])
	for _ in range(n):
		(x0, y0) = map(int, input().split())
		l.append((x0 - a, y0 - b))
	(x0, y0) = l[-1]
	for (x1, y1) in l:
		res.append(hypot(x1, y1))
		(dx, dy) = (x1 - x0, y1 - y0)
		if copysign(1.0, x0 * dx + y0 * dy) != copysign(1.0, x1 * dx + y1 * dy):
			res.append(abs(x0 * y1 - x1 * y0) / hypot(dx, dy))
		(x0, y0) = (x1, y1)
	print((max(res) ** 2 - min(res) ** 2) * pi)
main()


import math

def dis(a0, b0, x, y):
	return ((a0 - x) ** 2 + (b0 - y) ** 2) ** 0.5

def minDistance(A, B, E):
	AB = [B[0] - A[0], B[1] - A[1]]
	BE = [E[0] - B[0], E[1] - B[1]]
	AE = [E[0] - A[0], E[1] - A[1]]
	AB_BE = AB[0] * BE[0] + AB[1] * BE[1]
	AB_AE = AB[0] * AE[0] + AB[1] * AE[1]
	reqAns = 0
	if AB_BE > 0:
		y = E[1] - B[1]
		x = E[0] - B[0]
		return (x * x + y * y) ** 0.5
	elif AB_AE < 0:
		y = E[1] - A[1]
		x = E[0] - A[0]
		return (x * x + y * y) ** 0.5
	else:
		(x1, y1, x2, y2) = (AB[0], AB[1], AE[0], AE[1])
		mod = (x1 * x1 + y1 * y1) ** 0.5
		return abs(x1 * y2 - y1 * x2) / mod
(n, x0, y0) = map(int, input().split())
P = [list(map(int, input().split())) for _ in range(n)]
max_ = 0
min_ = float('inf')
for i in range(n):
	p = P[i]
	min_ = min(min_, minDistance(P[i], P[(i + 1) % n], [x0, y0]))
	max_ = max(max_, dis(x0, y0, p[0], p[1]))
print(math.pi * (max_ * max_ - min_ * min_))


import math
(n, px, py) = map(int, input().split())
(xs, ys, l) = (list(), list(), list())
for _ in range(n):
	(x, y) = map(int, input().split())
	xs.append(x - px)
	ys.append(y - py)
(x0, y0) = (xs[-1], ys[-1])
for (x, y) in zip(xs, ys):
	l.append(x * x + y * y)
	(dx, dy) = (x - x0, y - y0)
	if (x0 * dx + y0 * dy) * (x * dx + y * dy) < 0:
		x0 = x0 * y - x * y0
		l.append(x0 * x0 / (dx * dx + dy * dy))
	(x0, y0) = (x, y)
print(math.pi * (max(l) - min(l)))


def dot_product(v1, v2):
	return v1.x * v2.x + v1.y * v2.y

class vector:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def length(self):
		return (self.x ** 2 + self.y ** 2) ** 0.5

	def cross_product(self, v):
		return self.x * v.y - self.y * v.x

class line:

	def __init__(self, a, b):
		self.a = a
		self.b = b

	def distance(self, p):
		return abs(vector(p.x - self.a.x, p.y - self.a.y).cross_product(vector(p.x - self.b.x, p.y - self.b.y)) / vector(self.a.x - self.b.x, self.a.y - self.b.y).length())

class ray:

	def __init__(self, a, b):
		self.a = a
		self.b = b

	def distance(self, p):
		if dot_product(vector(self.b.x - self.a.x, self.b.y - self.a.y), vector(p.x - self.a.x, p.y - self.a.y)) >= 0:
			return line(self.a, self.b).distance(p)
		return vector(self.a.x - p.x, self.a.y - p.y).length()

class segment:

	def __init__(self, a, b):
		self.a = a
		self.b = b

	def min_distance(self, p):
		if dot_product(vector(self.b.x - self.a.x, self.b.y - self.a.y), vector(p.x - self.a.x, p.y - self.a.y)) >= 0:
			return ray(self.b, self.a).distance(p)
		return vector(self.a.x - p.x, self.a.y - p.y).length()

	def max_distance(self, p):
		return max(vector(self.a.x - p.x, self.a.y - p.y).length(), vector(self.b.x - p.x, self.b.y - p.y).length())
(n, x, y) = map(int, input().split())
p = vector(x, y)
min_r = 2000000
max_r = 0
a = [[] for i in range(n + 1)]
for i in range(n):
	a[i] = list(map(int, input().split()))
	a[i] = vector(a[i][0], a[i][1])
a[n] = a[0]
for i in range(n):
	s = segment(a[i], a[i + 1])
	min_r = min(min_r, s.min_distance(p))
	max_r = max(max_r, s.max_distance(p))
pi = 3.141592653589
print(pi * max_r ** 2 - pi * min_r ** 2)


import sys
import math

def dist2(x1, y1, x2, y2):
	return (x1 - x2) ** 2 + (y1 - y2) ** 2

def find_dist(x1, y1, x2, y2, X, Y):
	if x2 == x1:
		if min(y1, y2) <= Y <= max(y1, y2):
			return (x1 - X) ** 2
		else:
			return min(dist2(x1, y1, X, Y), dist2(x2, y2, X, Y))
	a = (y2 - y1) / (x2 - x1)
	b = y1 - a * x1
	x = (X + a * (Y - b)) / (1 + a * a)
	if min(x1, x2) <= x <= max(x1, x2):
		return dist2(x, a * x + b, X, Y)
	else:
		return min(dist2(x1, y1, X, Y), dist2(x2, y2, X, Y))

def main():
	(N, X, Y) = map(int, sys.stdin.readline().split())
	maxr = 0
	minr = 10 ** 15
	pts = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
	pts.append(pts[0])
	for i in range(0, len(pts) - 1):
		(x, y) = pts[i]
		r = dist2(x, y, X, Y)
		if r > maxr:
			maxr = r
		r = find_dist(x, y, pts[i + 1][0], pts[i + 1][1], X, Y)
		if r < minr:
			minr = r
	print('%.10f' % (math.pi * (maxr - minr)))
main()


__author__ = 'vboldovs'
import math
GLOBAL_INNER_PRODUCT_LIMIT = math.pow(10, -3)

class point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

class line:

	def __init__(self, start_point, end_point):
		self.x = end_point.x - start_point.x
		self.y = end_point.y - start_point.y

def distance(p1, p2):
	return math.sqrt(math.pow(p1.x - p2.x, 2) + math.pow(p1.y - p2.y, 2))

def product(line1, line2):
	return line1.x * line2.x + line1.y * line2.y
m = input().split()
n = int(m[0])
center = point(int(m[1]), int(m[2]))
points = []
for _i in range(n):
	temp = input().split()
	points.append(point(int(temp[0]), int(temp[1])))
max_r = distance(center, points[0])
min_r = max_r
for p in points:
	d = distance(p, center)
	max_r = max(max_r, d)
	min_r = min(min_r, d)
for i in range(n):
	s_point = points[i]
	try:
		e_point = points[i + 1]
	except IndexError:
		e_point = points[0]
	curr_line = line(s_point, e_point)
	prod_s = product(curr_line, line(s_point, center))
	prod_e = product(curr_line, line(e_point, center))
	if prod_s * prod_e > 0:
		continue
	alpha = prod_s / abs(prod_e - prod_s)
	p_point = point((1 - alpha) * s_point.x + alpha * e_point.x, (1 - alpha) * s_point.y + alpha * e_point.y)
	min_r = min(min_r, distance(p_point, center))
print(math.pi * math.pow(max_r, 2) - math.pi * math.pow(min_r, 2))


import math

def main():
	(n, xp, yp) = (int(x) for x in input().split())
	polygon = [None] * n
	for i in range(n):
		(xi, yi) = (int(x) for x in input().split())
		polygon[i] = (xi, yi)
	print(solver((xp, yp), polygon))

def solver(P, polygon):
	n = len(polygon)
	(xp, yp) = P
	distances = [distance(xp, yp, x, y) for (x, y) in polygon]
	maxDist = max(distances)
	minDist = min(distances)
	for i in range(n):
		p = perpenPoint(polygon[i % n], polygon[(i + 1) % n], P)
		if p != None:
			dist = distance(xp, yp, p[0], p[1])
			if dist < minDist:
				minDist = dist
	area = math.pi * (maxDist ** 2 - minDist ** 2)
	return area

def toLine(point1, point2):
	(x1, y1) = point1
	(x2, y2) = point2
	if x1 == x2:
		if y1 == y2:
			assert False
		else:
			return (1, 0, x1)
	else:
		a = (y2 - y1) / (x1 - x2)
		c = a * x1 + y1
		return (a, 1, c)

def perpenPoint(point1, point2, point):
	line = toLine(point1, point2)
	(a, b, c) = line
	if a == 0:
		(ap, bp) = (b, a)
	else:
		(ap, bp) = (-b / a, 1)
	(x, y) = point
	cp = ap * x + bp * y
	(xi, yi) = intersection(line, (ap, bp, cp))
	(x1, y1) = point1
	(x2, y2) = point2
	if min(x1, x2) <= xi and xi <= max(x1, x2) and (min(y1, y2) <= yi) and (yi <= max(y1, y2)):
		return (xi, yi)
	else:
		return None

def intersection(line1, line2):
	(a1, b1, c1) = line1
	(a2, b2, c2) = line2
	if b1 == 0 and a2 == 0:
		return (c1, c2)
	elif a1 == 0 and b2 == 0:
		return (c2, c1)
	else:
		x = (b2 * c1 - b1 * c2) / (a1 * b2 - a2 * b1)
		y = (c1 - a1 * x) / b1
		return (x, y)

def almostEqual(x, y):
	return abs(x - y) < 10 ** (-16)

def distance(x1, y1, x2, y2):
	leg1 = abs(x1 - x2)
	leg2 = abs(y1 - y2)
	return (leg1 ** 2 + leg2 ** 2) ** 0.5
main()


import math

def dist(x, y, x1, y1, x2, y2):
	a = x - x1
	b = y - y1
	c = x2 - x1
	d = y2 - y1
	dot = a * c + b * d
	lensq = c * c + d * d
	param = -1
	if lensq != 0:
		param = dot / lensq
	if param < 0:
		xx = x1
		yy = y1
	elif param > 1:
		xx = x2
		yy = y2
	else:
		xx = x1 + param * c
		yy = y1 + param * d
	dx = x - xx
	dy = y - yy
	return (dx * dx + dy * dy) ** 0.5

def dist2(x, y):
	return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
import math
maxx = -1
minn = 100000000000000000
pts = []
(a, b, c) = list(map(int, input().split(' ')))
for i in range(a):
	(x, y) = list(map(int, input().split(' ')))
	pts.append([x, y])
k = []
for i in pts:
	k.append(dist2(i, [b, c]))
pts.append(pts[0])
for i in range(a):
	k.append(dist(b, c, pts[i][0], pts[i][1], pts[i + 1][0], pts[i + 1][1]))
print((max(k) ** 2 - min(k) ** 2) * math.pi)


import functools

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def squared_distance(self, another_point):
		return (self.x - another_point.x) ** 2 + (self.y - another_point.y) ** 2

def point_segment_distance(p, a, b):
	ap = (p.x - a.x, p.y - a.y)
	ab = (b.x - a.x, b.y - a.y)
	bp = (p.x - b.x, p.y - b.y)
	indicator = (ap[0] * ab[0] + ap[1] * ab[1]) / (ab[0] ** 2 + ab[1] ** 2)
	if 0 < indicator < 1:
		return ap[0] ** 2 + ap[1] ** 2 - indicator ** 2 * (ab[0] ** 2 + ab[1] ** 2)
	if indicator <= 0:
		return ap[0] ** 2 + ap[1] ** 2
	if indicator >= 1:
		return bp[0] ** 2 + bp[1] ** 2

class SnowBlower:

	def solution(self):
		first_line = input()
		first_line = first_line.split(' ')
		num_vertices = int(first_line[0])
		origin = Point(int(first_line[1]), int(first_line[2]))
		vertices = []
		for _ in range(num_vertices):
			point = input()
			point = point.split(' ')
			vertices.append(Point(int(point[0]), int(point[1])))
		max_distance = float('-inf')
		min_distance = float('inf')
		for vertex in vertices:
			squared_distance = origin.squared_distance(vertex)
			max_distance = squared_distance if squared_distance > max_distance else max_distance
		for i in range(num_vertices):
			distance = point_segment_distance(origin, vertices[i], vertices[i - 1])
			min_distance = distance if distance < min_distance else min_distance
		pi = 3.14159265358
		print(pi * (max_distance - min_distance))

def __starting_point():
	snow_blower = SnowBlower()
	snow_blower.solution()
__starting_point()