Mountain Is Quiet and Alone
题号:NC236487
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

"Slipped, tumbled, Mountain is quiet and alone." is a haiku by Santōka Taneda (1882-1940).
Peng is a young climber who enjoys mountaineering really much. One day he was climbing a tall mountain alone when he, unfortunately, slipped. He started tumbling, rolling down the mountain.

The mountain (up to the point where Peng is at) is a monotone slope described by n points such that and . The slope contains the following segments: , ((0,0),(x_1,y_1)), and for all . For simplicity we consider Peng to be a segment of length 1, and we call the end of the segment Peng's "head".

We now describe the rolling process. Peng always rotates counter-clockwise (downhill) around his lowest contact point with the hill. Whenever he has a new (lower) contact point with the hill, he starts rolling from that point. He only stops rolling when his"head" has y-coordinate 0.

Peng would like to know the total length his "head" travels in the rolling process. 

输入描述:

The first line contains an integer n ().
For each of the following n lines, the i-th line contains two real numbers x_i and y_i with at most 6 digits of precision.

输出描述:

Output one real number, the total distance.
Your answer will be considered correct if its absolute or relative error does not exceed . Formally let your answer be a and jury's answer be b. Your answer will be considered correct if .
示例1

输入

复制
1
0.5 0.5

输出

复制
2.094395102393195

说明

示例2

输入

复制
2
0.2 0.8
1 1

输出

复制
4.465554239614399

说明

备注:

It is guaranteed that during the rotation, when an end point of the segment is in contact with the hill, the point is not within 0.0001 distance of points .