407415: GYM102785 K Meson Collider

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Meson Collidertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Four spark chambers are installed along the large meson collider, which monitors the interactions of mesons moving in a circle at high velocities.

In order to receive reliable synchronized data from spark chambers and process it quickly, it is required to place 2 computers inside the circle, connect them via a cable to each other, as well as to the spark chambers. Each camera must be connected to at least one computer. The task is to minimize the total length of the cable for maximum synchronization.

Write a program that calculates the cable length using the known location of the spark chambers.

Input

In the first line, five integers are entered, separated by spaces, R is the radius of the circle along which the mesons move ($$$1 \leq R\leq 100$$$), $$$g_1$$$, $$$g_2$$$, $$$g_3$$$, $$$g_4$$$ are the angles at which spark chambers are visible from the center of the circle ($$$60^\circ \leq g_i \leq 360^\circ$$$).

Output

Print the total length of the required cable. Your answer will be accepted if absolute or relative error does not exceed $$$10^{-6}$$$.

Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is considered correct if $$$\frac{|a-b|}{\max(1, |b|)} \leq 10^{-6}$$$.

ExampleInput
10 60 120 60 120
Output
34.64101615
Note

Illustration for test

加入题单

上一题 下一题 算法标签: