Signals 2

Choose a subset of points with distinct x coordinates, sort them by x, and maximize the total Euclidean distance between consecutive chosen points.

Medium7Dynamic programmingGeometrySortingDivide and conquerNo attempts yetTime limit1.5sMemory limit256 MB

Problem

There are NN signals on the coordinate plane. Signal ii sits at (xi,yi)(x_i, y_i), and no two signals share a position.

You build a communication system out of some of the signals. Line the chosen signals up in increasing order of xx coordinate and connect each neighboring pair in turn, so the chosen signals must all have different xx coordinates. The length of the system is the sum of the Euclidean lengths of the connecting segments. A system built from a single signal has length 00.

A longer system carries the transmission further. Find the length of the longest communication system.

Input

The first line contains the number of signals NN. (1N1061 \le N \le 10^6)

Each of the next NN lines contains the coordinates xix_i and yiy_i of one signal, separated by a space. (108xi,yi108-10^8 \le x_i, y_i \le 10^8, and xix_i and yiy_i are integers)

Output

Print the length of the longest communication system on one line, rounded to seven digits after the decimal point. Pad with zeros so that seven digits always follow the decimal point.