This page is still under construction.

Parts of this page are still being built. What you see may change.

Lying From You

Time limit10sMemory limit512 MB

Summary
Given n lines y = a_i x + b_i, change coefficients at L1 cost so all lines pass through one point; find the infimum total cost.
Level

Hard8 of 10

Topics
Math, Geometry, Binary search, Greedy
Solved
No attempts yet

Problem

You are given nn lines on the plane, each defined by an equation of the form y=aix+biy = a_i x + b_i. Changing the coefficients of one line from (a,b)(a, b) to (a′,b′)(a', b') costs ∣a−a′∣+∣b−b′∣|a - a'| + |b - b'| rubles. You can perform this operation any number of times on any lines, and the new coefficients can be any real numbers. The goal is to make all the lines pass through a single point.

Let CC be the set of total costs of operations that achieve the goal. Find inf⁡C\inf C, the greatest lower bound on the total cost.

Input

The first line contains a positive integer nn (1≤n≤1051 \le n \le 10^5), the number of lines.

Each of the next nn lines contains two integers aia_i and bib_i (∣ai∣,∣bi∣≤106|a_i|, |b_i| \le 10^6).

Output

Print the answer on a single line with absolute or relative error no more than 10−610^{-6}.

Hint

In the first example, it is enough to change bb of the first line to −0.5-0.5.

Examples2

  1. Example 1

    Input
    3
    0 0
    1 -1
    -1 0
    
    Expected output
    0.500000000000000
    
  2. Example 2

    Input
    5
    4 1
    3 0
    3 1
    2 0
    1 2
    
    Expected output
    3.000000000000000