This page is still under construction.

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

Rails

Time limit2sMemory limit256 MB

Summary
Given 2n distinct lines, pair them so each pair has two parallel lines at the same distance d, and find the smallest such d.
Level

Hard8 of 10

Topics
Geometry, Hash map, Sorting, Math
Solved
No attempts yet

Problem

An important parameter of a railway is its track gauge, the distance between the two rails a train runs on. This parameter determines which types of trains and other machines can run on the railway.

A recent space expedition to the planet RCC-0805 discovered that this planet has railways too. A railway depot was even found, but the track gauge could not yet be determined. The railways on this planet were laid without sleepers, so it is not always easy to tell which rails pair with each other.

You are given a layout of the rails on the territory of the railway depot. For simplicity, treat the territory as an infinite plane, with each rail represented by a line. Find the minimum track gauge dd such that the rails can be split into pairs where the two rails in each pair are parallel and the distance between them is dd.

Input

The first line contains an integer nn (1≤n≤20001 \le n \le 2000). Each of the next 2n2n lines contains four integers xi,1x_{i,1}, yi,1y_{i,1}, xi,2x_{i,2}, yi,2y_{i,2}, the coordinates of two distinct points the rail passes through. The absolute value of every coordinate does not exceed 1000. The lines corresponding to different rails do not coincide.

Output

Print the minimum possible track gauge as a real number. It must be determined with an error of at most 10−610^{-6}.

If no track gauge allows the rails to be split into pairs satisfying the requirements of the problem, print −1-1.

Examples1

  1. Example 1

    Input
    3
    0 0 0 1
    1 0 1 1
    2 0 2 1
    3 0 3 1
    0 0 1 0
    0 1 1 1
    
    Expected output
    1