UCV2013I - Tambourine

no tags 

Little HH loves tambourines. He loves them so much that now he wants to build them. A tambourine is a musical instrument shown in Figure 1(a). As you can see in Figure 1(b) the tambourine is just a big circle of radius R with N smaller circles of radius r (r < R).

Tambourine

Figure 2: (a) A tambourine. (b) The radius of the circles is shown. (c) There is a 2N sides regular polygon inscribed in the outer circle

HH knows the radius of the small circles (r), he also knows the number of small circles that he has (N). And he knows that the small circles should be centered on the center of the even sides of a 2N sides regular polygon inscribed in the big circle (the sides of this polygon each measuring 2r), as shown on Figure 1(c). Now HH wants you to help him find the radius R of the big circle.

Input

The input contains several test cases. Each test case consists of two values r and N as described previously. (0 < r <= 100), (2 <= N <= 10000).

The end of input is indicated by a test case with r = N = 0.

Output

For each test case you must print a number (rounded up to two decimal places) showing the radius of the big circle to build the tambourine.

Example

Input:
1 4
2 4
1 8
0 0 Output: 2.61
5.23
5.13

hide comments
UNIDENTIFIED: 2013-09-03 13:52:01

give some more test cases

alpha decay: 2013-08-26 16:38:32

use acos(-1) && double && run for r=0

Hitman: 2013-08-24 17:52:59

Sincere advice use pi = acos(-1)

hiddenman: 2013-08-18 08:45:05

easy 1 bt concern on d value of pi....it must be taken acos(-1)....... :)

rb: 2013-08-17 16:46:31

easy one move to tutorial....
http://www.mathsisfun.com/geometry/regular-polygons.html

aks: 2013-08-16 18:03:02

Hey,can you check my code . Id is
9852918.Please provide a hint ,to find the bug.

shannider: 2013-08-15 23:44:49

take pi as acos(-1);

Thanxx mundane programmer.
I was getting wa when using pi =3.14159265358979

Last edit: 2013-08-16 04:38:24
Amey Telawane: 2013-08-15 09:01:06

0.25 for this problem?? seriously :p

The Mundane Programmer: 2013-08-13 21:56:31

Very easy problem....... take pi=acos(-1)

pranjuldb: 2013-08-13 13:35:44

easy problem..got accepted in 1st attempt... :)


Added by:Hector Navarro
Date:2013-07-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Local UCV 2013. Héctor Navarro