The Ant and the Tree#2815

The Ant and the Tree

1 second
64 megabytes
Medium

An ant is located in a forest on a flat surface at the coordinates x_1, y_1 and is moving toward the point x_2, y_2. In the forest, there is a tree whose trunk base is a circle with center at , and radius . The tree may block the ant's direct path. In this case, the ant must go around the tree trunk.

Write a program to determine the length of the shortest possible path the ant can travel.

Input

The input contains real numbers x_1, y_1, x_2, y_2, , , , separated by spaces. The numbers are in the range from to , with r > 0. The ant's starting and ending points are not located inside the circle.

Output

Output a single real number — the length of the shortest path. The absolute error of the result must not exceed (the answer should be printed with at least digits after the decimal point).

Examples

Example 1

Loading
Loading