It was decided in IT City to distinguish successes of local IT companies by awards in the form of stars covered with gold from one side. To order the stars it is necessary to estimate order cost that depends on the area of gold-plating. Write a program that can calculate the area of a star.

A "star" figure having n ≥ 5 corners where n is a prime number is constructed the following way. On the circle of radius r n points are selected so that the distances between the adjacent ones are equal. Then every point is connected by a segment with two maximally distant points. All areas bounded by the segments parts are the figure parts. [Image] 


-----Input-----

The only line of the input contains two integers n (5 ≤ n < 10^9, n is prime) and r (1 ≤ r ≤ 10^9) — the number of the star corners and the radius of the circumcircle correspondingly.


-----Output-----

Output one number — the star area. The relative error of your answer should not be greater than 10^{ - 7}.


-----Examples-----
Input
7 10

Output
108.395919545675

Difficulty: interview

Starter code:

Solutions:
from math import sin, cos, pi

n, r = map(int, input().split())

print(n * r**2 * sin(pi / n) * cos(pi * (n // 2) / n) / cos(pi * (n // 2 - 1) / n))

import math
n, R = [int(x) for x in input().split()]
phi = math.pi/(2*n)
A = math.sin(2*phi) * (math.cos(2*phi) - math.sin(2*phi) * math.tan(math.pi/2 - 3*phi))
print(n*R*R*A)




3

import math
# from matplotlib import pyplot as plt

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

	def length(self):
		return math.hypot(self.x, self.y)

	def dot(self, other):
		return self.x * other.x + self.y * other.y

	def angleWith(self, other):
		return math.acos( self.dot(other) / (self.length() * other.length()) )

	def normalize(self):
		self /= self.length()

	def normalized(self):
		return self / self.length()

	def rotate(self, angle):
		sine = math.sin(angle)
		cosine = math.cos(angle)
		x = self.x * cosine - self.y * sine
		y = self.x * sine + self.y * cosine

		self.x = x
		self.y = y

	def rotated(self, angle):
		sine = math.sin(angle)
		cosine = math.cos(angle)
		x = self.x * cosine - self.y * sine
		y = self.x * sine + self.y * cosine

		return Vector(x, y)

	def __iadd__(self, other):
		self.x += other.x
		self.y += other.y
		return self

	def __isub__(self, other):
		self.x -= other.x
		self.y -= other.y
		return self

	def __add__(self, other):
		return Vector(self.x + other.x, self.y + other.y)

	def __sub__(self, other):
		return Vector(self.x - other.x, self.y - other.y)

	def __imul__(self, other):
		self.x *= other
		self.y *= other
		return self

	def __itruediv__(self, other):
		self.x /= other
		self.y /= other
		return self

	def  __mul__(self, other):
		return Vector(self.x * other, self.y * other)

	def __truediv__(self, other):
		return Vector(self.x / other, self.y / other)

	def __neg__(self):
		return Vector(-self.x, -self.y)

	def __str__(self):
		return str(self.x) + ' ' + str(self.y)
		# return "{:.2f} {:.2f}".format(self.x, self.y)

def point_coord(n, r, i):
	d_angle = 2*math.pi / n

	return Vector(0, r).rotated(-i*d_angle)

# def line_intersection(p0, p1, p2, p3):
# 	# xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
# 	# ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])

# 	dx = (p0.x - p2.x, p1.x - p3.x)
# 	dy = (p0.y - p2.y, p1.y - p3.y)

# 	def det(a, b):
# 		return a[0] * b[1] - a[1] * b[0]

# 	div = det(dx, dy)
# 	if div == 0:
# 		raise Exception('lines do not intersect')

# 	line1 = ((p0.x, p0.y), (p1.x, p1.y))
# 	line2 = ((p2.x, p2.y), (p3.x, p3.y))

# 	d = ( det(*line1), det(*line2) )

# 	x = det(d, dx) / div
# 	y = det(d, dy) / div
# 	return Vector(x, y)

def line_intersection(line1, line2):
	xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
	ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1]) #Typo was here

	def det(a, b):
		return a[0] * b[1] - a[1] * b[0]

	div = det(xdiff, ydiff)
	if div == 0:
		raise Exception('lines do not intersect')

	d = (det(*line1), det(*line2))
	x = det(d, xdiff) / div
	y = det(d, ydiff) / div
	return x, y

# print(line_intersection(((0,0), (4,4)), ((1,3), (3,1))))
# print(line_intersection(Vector(0,0), Vector(4,4), Vector(1,3), Vector(3,1)))

n, r = [int(i) for i in input().split()]

# n = 7
# r = 10

from1 = 0
from2 = 1
to1 = n//2
to2 = to1 + 2

# p = []
# for i in range(n):
# 	p.append(point_coord(n, r, i))

# x = [i.x for i in p]
# y = [i.y for i in p]

# plt.scatter(x, y)
# plt.axis('equal')
# plt.show()

p0 = point_coord(n, r, from1)
p1 = point_coord(n, r, from2)
p2 = point_coord(n, r, to1)
p3 = point_coord(n, r, to2)

# plt.plot([p0.x, p2.x], [p0.y, p2.y])
# plt.plot([p1.x, p3.x], [p1.y, p3.y])

# print(p0)
# print(p1)
# print(p2)
# print(p3)

v1 = p2 - p0
v2 = p3 - p1

# phi = v1.angleWith(v2)
# # omega = math.pi - phi
# print(phi)

line1 = ((p0.x, p0.y), (p2.x, p2.y))
line2 = ((p1.x, p1.y), (p3.x, p3.y))

# p_int =line_intersection(p0, p1, p2, p3)
x,y =line_intersection(line1, line2)
p_int = Vector(x, y)
# print(p_int)
# plt.scatter([p_int.x], [p_int.y], c='r')
# plt.show()

a = p_int.length()
# print(a)
theta = math.pi / n
# print(theta)
s = 0.5*r*a*math.sin(theta)
print(2*n*s)

# print(p_int)
# print(p0)
# print(p_int - p0)
# print(d)
# print()

# s = 0.5 * d * d * phi
# print(s)
# print(math.pi*r*r - n*s)


import math
n, R = [int(x) for x in input().split()]
phi = math.pi/(2*n)
A = math.sin(2*phi) * (math.cos(2*phi) - math.sin(2*phi) * math.tan(math.pi/2 - 3*phi))
print(n*R*R*A)


import math
n,r = list(map(int,input().split()))
a = math.pi/n
b = a/2
c = math.pi-a-b
side = r*math.sin(a)/(2*math.sin(c))
area = 0.5*math.sin(b)*side*r*n*4
print(area)


import math

n, r = list(map(float, input().split()))

pi = math.pi

part = pi / n
s = n * r * r * math.sin(2. * part) / 2.
bad = n * (math.sin(part) * r) ** 2 * math.tan(pi / 2. - 1.5 * part)

print(s - bad)


from math import sin, cos, pi

n, r = map(int, input().split())

print(n * r ** 2 * sin(pi / n) * cos(pi * (n // 2) / n) / cos(pi * (n // 2 - 1) / n))

from decimal import *
from math import sin , pi , sqrt

def getRadian( x ):
    return x*Decimal(pi)/180

def area( a , b , c ):

    p = (a+b+c)/2
    return Decimal( sqrt( p*(p-a)*(p-b)*(p-c) ) )

def __starting_point():

    getcontext().prec = 100
    n , r = map( Decimal , input().split() )

    beta = 90/n
    beta_radian = getRadian( beta )
    #print( beta_radian )

    gamma = 180/n
    gamma_radian = getRadian( gamma )
    #print( gamma_radian )

    S = r*r*Decimal(sin(beta_radian))*Decimal(sin(gamma_radian))/Decimal(sin(beta_radian+gamma_radian))
    print(n*S)
__starting_point()

from math import sin, cos, pi

n, r = map(int, input().split())

print(n * r**2 * sin(pi / n) * cos(pi * (n // 2) / n) / cos(pi * (n // 2 - 1) / n))

import math

n, r = list(map(int, input().split(' ')))

alpha = math.pi/n/2
beta = math.pi/n
gamma = math.pi-alpha-beta

print(r*r*math.sin(alpha)*math.sin(beta)/math.sin(gamma)*n)


import math
n, r = list(map(int, input().split()))
a = math.pi / n
b = a / 2
print(r * math.sin(b) / math.sin(math.pi - a - b) * math.sin(a) * r * n)
                               


import math
n, r = list(map(int, input().split()))

X = 2 * r * math.sin(math.pi / n)
Y = X * math.sin(math.pi * (n - 3) / (2 * n)) / math.sin(3 * math.pi / n)

S1 = 1 / 2 * Y * Y * math.sin(3 * math.pi / n)
S2 = r * r * (math.pi / n - 1 / 2 * math.sin(2 * math.pi / n))
ans = math.pi * r * r - n * (S1 + S2)
print(ans)


import math
PI = math.acos(-1)

n, R = list(map(int, input().split()))
ag = 2*PI / n
L = 2 * math.sin(ag/2) * R

SP = n * L / 2 * R * math.cos(ag/2) 

ang = (PI - ag - ag / 2) / 2
S = L**2 / 4 * math.tan(ang)
SS = SP - S * n
print("%.10f" % SS)
    


from sys import stdin
from math import pi, sin, tan
n, r = map(int, stdin.readline().split())
a = 2*pi/n
A = r*r/2 * (a - sin(a))
c = n//2 * 2*pi/n
b = (c-a)/2
s = 2*r*sin(a/2)
h = tan(b)*s/2
A = A + h*s/2
result = pi*r*r - n*A
print(result)

import math

p,r = list(map(int,input().split() ))

print((math.sin(math.pi/p)**2 /math.tan(1.5*math.pi/p) - math.sin(2*math.pi/p)/2)*-r*r*p)


import math

n, r = list(map(int, input().split()))
print(n * r * r / (1 / math.tan(math.pi / (2*n)) + 1 / math.tan(math.pi/n)))


import math
Pi = math.pi
n, r = list(map(float, input().split()))
x = math.tan (Pi / n)
y = math.tan (Pi / n / 2)
base = r / (1 / x + 1 / y)
print(n * r * base)


import math
ln = input().split(" ")
n = int(ln[0])
r = int(ln[1])

tot_area = n / 2 * (math.sin(2 * math.pi / n)) * r * r

if n < 10 ** 6:
    x = (1 - math.cos(2 * math.pi / n)) / (1 - math.cos(3 * math.pi / n))
else:
    x = 4 / 9
x *= r ** 2

small_area = n / 2 * math.sin(3 * math.pi / n) * x

print(tot_area - small_area)


from math import sin, sqrt, radians

n, r = map(int, input().split())

o = 360 / (n * 2)
a = o / 2
c = 180 - o - a

A = (r * sin(radians(a))) / sin(radians(c))
O = (r * sin(radians(o))) / sin(radians(c))

S = (A + O + r) / 2

area = 0.5 * A * r * sin(radians(o))
print(2 * n * area)

from math import*
n, r = map(int, input().split())
x=360/n
a=x/4/180*pi
b=x*3/4/180*pi
x=tan(a)
y=tan(b)
S = (r**2)*sin(a)*cos(a)/2
S1 = (r*sin(a)/tan(b))*r*sin(a)/2
S2=S-S1
print(S2*2*n)

from math import pi, sin, tan


def zvezda(n, r):
    alpha = (2 * pi) / n
    s1 = r * r * sin(alpha * 0.5) * sin(alpha * 0.5) / tan(0.5 * (alpha + 0.5 * alpha))
    s2 = 0.5 * (alpha - sin(alpha)) * r * r
    s3 = pi * r * r
    return format(s3 - n * (s2 + s1), '.10f')


N, R = [int(j) for j in input().split()]
print(zvezda(N, R))


from math import *

pi = 3.141592653589793238462643383279502884197
n, r = list(map(int, input().split()))

a = tan(pi/(2*n))
b = tan(pi/n)
a = 1/a + 1/b
print(r*r/a*n)


#More es mi pastor nada me faltara
import math
ln = input().split(" ")
n = int(ln[0])
r = int(ln[1])
tot_area = n / 2 * (math.sin(2 * math.pi / n)) * r * r
if n < 10 ** 6:
    x = (1 - math.cos(2 * math.pi / n)) / (1 - math.cos(3 * math.pi / n))
else:
    x = 4 / 9
x *= r ** 2
small_area = n / 2 * math.sin(3 * math.pi / n) * x
print(tot_area - small_area)

from math import *

N, R = list(map(int, input().split()))

def get(i):
    theta = 2 * pi / N * i
    return R * cos(theta), R * sin(theta)

def line(p, q):
    m = (q[1] - p[1]) / (q[0] - p[0])
    b = p[1] - m * p[0]
    return (m, b)

def intersect(l1, l2):
    x = (l1[1] - l2[1]) / (l2[0] - l1[0])
    y = l1[0] * x + l1[1]
    return (x, y)

def dist(p, q):
    return sqrt((p[0] - q[0])**2 + (p[1] - q[1])**2)

p0 = get(0)
p1 = get(N // 2)

p2 = get(1)
p3 = get(N // 2 + 2)

p4 = intersect(line(p0, p1), line(p2, p3))

midpt = (p0[0] + p2[0]) / 2, (p0[1] + p2[1]) / 2

h1 = dist(midpt, p4)
h2 = dist(midpt, (0, 0))

area = 0.5 * (h2 - h1) * dist(p0, p2)

print(area * N)


import os, sys, pdb
import time, calendar, datetime
import math, itertools
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, list(range(n, n-r, -1)), 1)
    denom = reduce(op.mul, list(range(1, r+1)), 1)
    return numer // denom

n, r = list(map(int, input().split()))
s = 2 * r * math.sin(math.pi / n)
Apoly = 1 / (4 * math.tan(math.pi / n))
Asub  = math.tan(math.pi * (1/2 - 3/(2*n))) / 4

print(n*s**2*(Apoly - Asub))