C. NN and the Optical Illusion

NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles:

                              

It turned out that the circles are equal. NN was very surprised by this fact, so he decided to create a similar picture himself.

He managed to calculate the number of outer circles nn and the radius of the inner circle rr. NN thinks that, using this information, you can exactly determine the radius of the outer circles RR so that the inner circle touches all of the outer ones externally and each pair of neighboring outer circles also touches each other. While NN tried very hard to guess the required radius, he didn't manage to do that.

Help NN find the required radius for building the required picture.

Input

The first and the only line of the input file contains two numbers nn and rr (3≤n≤1003≤n≤100, 1≤r≤1001≤r≤100) — the number of the outer circles and the radius of the inner circle respectively.

Output

Output a single number RR — the radius of the outer circle required for building the required picture.

Your answer will be accepted if its relative or absolute error does not exceed 10−610−6.

Formally, if your answer is aa and the jury's answer is bb. Your answer is accepted if and only when |a−b|max(1,|b|)≤10−6|a−b|max(1,|b|)≤10−6.

Examples

input

3 1

output

6.4641016

input

6 1

output

1.0000000

input

100 100

output

3.2429391

 题意:一个半径为r的小圆被n个大圆外切,切这几个大圆也相切,求大圆的半径;

 

先考虑n==3时的情形:

 

                                        

当n==3时,三个大圆的圆心与小圆的圆心相连,内部构成直角△OoD,长度关系Oo=R+r,OD=R;

则根据正弦定理,sin∠OoD=R/(R+r);

而∠OoD的度数即为 360 / 3 / 2=60;

通过计算可得 R=r*sin∠OoD/(1-sin∠OoD);

类推n==4及以上的情况,都可以构成相似的直角三角形,而内角的大小与外接圆的数目相关,即 ∠OoD=360 / n / 2;

那么代码就很容易写了:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define closeio std::ios::sync_with_stdio(false)
#define pi 3.1415926
 
int main()
{
	double R,r,n,c,Sin;
	cin>>n>>r; 
	c=(double)360/n/2;
	//cout<<c<<endl;
	Sin=sin(c*pi/180);			//度数转弧度 
	//cout<<Sin<<endl;
	R=r*Sin/(1-Sin);
	printf("%.8lf\n",R);
	return 0;
}