Under construction

Still being built. Things may change

Jump if you can!

Time limit2sMemory limit1024 MB

Summary
Find the shortest rope length that lets you jump from the first iceberg to the last, where a rope may not cross any iceberg between them.
Level

Medium7 of 10

Topics
Geometry, Binary search, Graph
Solved
No attempts yet

Statement

One of the most popular games among the commando penguins is a game called jump if you can.

The rules are simple. Far away in Antarctica, at a secret penguin base, stand nn icebergs in a single line. Each iceberg is very tall and narrow, given by its distance xix_i from the reference point and its height yiy_i. A participant takes a rope of length ll and climbs to the top of the first iceberg. The goal is to reach the last iceberg by any means. With the rope, a penguin can jump from one iceberg to another if the distance between their tops is at most the rope length and the rope does not cross any iceberg between them (note that jumps can go from a lower iceberg to a higher one and from a higher one to a lower one). The winner is the boldest but most calculating penguin: the one who completes the task using the shortest rope.

Skipper decided to give himself and his team a short vacation, and of course to spend it at that same Antarctic base. The trip from Madagascar is long, so Kowalski, the smartest of the team, wants to prepare well for the upcoming contest. He wants to find in advance the minimum rope length needed to reach the last iceberg and win. Studying such things is not a common penguin pursuit, so he asked you for help.

Input

The first line contains one integer nn (2≤n≤1000002 \le n \le 100000), the number of icebergs.

The second line contains nn pairs of integers xi,yix_i, y_i (0≤xi<xi+1≤1090 \le x_i < x_{i+1} \le 10^9, 0≤yi≤1090 \le y_i \le 10^9), the coordinates of the iceberg tops.

Output

Print one number, the minimum rope length needed to get from the first iceberg to the last one. The answer is accepted if its absolute or relative error does not exceed 10−610^{-6}.

Examples1

  1. Example 1

    Input
    3
    0 10
    5 15
    10 10
    
    Expected output
    7.0710678119