Tram

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

It is 1815 and the politicians in Lund have just decided to build a tram line in Lund. Oh, sorry. That was wrong, let's start over. It is 2015 and the politicians in Lund have just decided to build a tram line in Lund.

The politicians have already decided that the tram line should run from south-east to north-west. In order not to cause too many complaints from the citizens, they want to make the line as useful as possible. Therefore they want to minimize the total unusefulness of the tram.

The unusefulness for citizen ii is equal to the square of the closest distance from the citizen's home to the tram line. The total unusefulness of the tram is the sum of all citizens' unusefulnesses.

Given the coordinates of each citizen's home, determine the value aa minimizing the total unusefulnes, where the equation of the tram line is given by y=x+ay=x+a.

입력

The first line of input consists of an integer, 1N1051\leq N\leq 10^5, the number of citizens in Lund. Then follow NN lines, with two space-separated integers x_i,y_ix\_i,y\_i (x_i,y_i106|x\_i|,|y\_i|\leq 10^6), the coordinates of citizen ii's home.

출력

The output consists of a single number, aa, minimizing the total unusefulness. An answer will be accepted if it is within an absolute or relative error of 10310^{-3}.