402904: GYM100942 E The Carpet

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

Description

E. The Carpettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

A perfectly round crater was found on a distant planet. Two stations arrived to study the crater. In order to start exploration, it is necessary to lay a special carpet roll on the surface, so that the rovers will use it to move around. It is possible to unroll the carpet all over the surface except for the crater area. The rovers must be able to move on the carpet roll from one station to another and to the crater’s edge. Carpets are very expensive in Space, that's why it is necessary to make the carpet roll's length as short as possible.

Input

The first line contains two pairs of Cartesian coordinates of the stations separated by space. The second line contains coordinates of the center and the crater's radius. All numbers are integers and do not exceed 40000 by absolute value. It is guaranteed that the stations are outside the crater.

Output

Output the total length of the carpet roll with absolute or relative error that does not exceed 10 - 6.

ExamplesInput
3 4 4 4
0 0 5
Output
1.000000

加入题单

上一题 下一题 算法标签: