PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000395. Khu bảo tồn thiên nhiên (Nature Reserve)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Khu bảo tồn thiên nhiên (Nature Reserve)

Nature Reserve

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Model a forest as a coordinate plane. There are nn rare animals, with animal ii living at (xi,yi)(x_i,y_i). A circular reserve, including its interior and boundary, must cover all dwellings.

The river follows y=0y=0. The reserve must touch the river so animals can drink, but may not cross it because boats must pass. Thus the closed disk and the line y=0y=0 must have exactly one common point.

Find the minimum radius satisfying these requirements, or determine that no reserve is possible.

Input

The first line contains the integer nn, the number of dwellings.

Each of the following nn lines contains two integers xi,yix_i,y_i, the coordinates of dwelling ii.

Output

Print -1 if no reserve exists. Otherwise print one real number, the minimum radius. For a submitted value aa and correct value bb, the allowed error is ∣a−b∣≤10−6max⁡(1,∣b∣)|a-b|\le10^{-6}\max(1,|b|).

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20; −107≤xi,yi≤107-10^7\le x_i,y_i\le10^7 and yi≠0y_i\ne0 for every 1≤i≤n1\le i\le n; all coordinate pairs are distinct.
  • Subtask 2 (30 points): 1≤n≤20001\le n\le 2000; −107≤xi,yi≤107-10^7\le x_i,y_i\le10^7 and yi≠0y_i\ne0 for every 1≤i≤n1\le i\le n; all coordinate pairs are distinct.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le 10^5; −107≤xi,yi≤107-10^7\le x_i,y_i\le10^7 and yi≠0y_i\ne0 for every 1≤i≤n1\le i\le n; all coordinate pairs are distinct.

Examples

Input

1
0 1

Output

0.5

Explanation

The point (0,1)(0,1) is one unit from the river. The diameter must be at least one. Center (0,0.5)(0,0.5) and radius 0.50.5 attain the bound.

Input

3
0 1
0 2
0 -3

Output

-1

Explanation

Two points are above the river and the third is below. A tangent disk lies on one side, so it cannot cover all three.

Input

2
0 1
1 1

Output

0.625

Explanation

The center (0.5,r)(0.5,r) is symmetric between the points. Squared distance to either is 0.25+(1−r)20.25+(1-r)^2. At least one horizontal offset is at least 0.50.5 for any center, so r2≥0.25+(1−r)2r^2\ge0.25+(1-r)^2, giving r≥0.625r\ge0.625. The center (0.5,0.625)(0.5,0.625) attains the bound.