There is a forest that we model as a plane and live $n$ rare animals. Animal number $i$ has its lair in the point $(x_{i}, y_{i})$. In order to protect them, a decision to build a nature reserve has been made.

The reserve must have a form of a circle containing all lairs. There is also a straight river flowing through the forest. All animals drink from this river, therefore it must have at least one common point with the reserve. On the other hand, ships constantly sail along the river, so the reserve must not have more than one common point with the river.

For convenience, scientists have made a transformation of coordinates so that the river is defined by $y = 0$. Check whether it is possible to build a reserve, and if possible, find the minimum possible radius of such a reserve.


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 10^5$) — the number of animals. 

Each of the next $n$ lines contains two integers $x_{i}$, $y_{i}$ ($-10^7 \le x_{i}, y_{i} \le 10^7$) — the coordinates of the $i$-th animal's lair. It is guaranteed that $y_{i} \neq 0$. No two lairs coincide.


-----Output-----

If the reserve cannot be built, print $-1$. Otherwise print the minimum radius. Your answer will be accepted if absolute or relative error does not exceed $10^{-6}$.

Formally, let your answer be $a$, and the jury's answer be $b$. Your answer is considered correct if $\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$.


-----Examples-----
Input
1
0 1

Output
0.5
Input
3
0 1
0 2
0 -3

Output
-1

Input
2
0 1
1 1

Output
0.625


-----Note-----

In the first sample it is optimal to build the reserve with the radius equal to $0.5$ and the center in $(0,\ 0.5)$.

In the second sample it is impossible to build a reserve.

In the third sample it is optimal to build the reserve with the radius equal to $\frac{5}{8}$ and the center in $(\frac{1}{2},\ \frac{5}{8})$.

Difficulty: HARD
Tags: Geometry

Sorting
Skill types: Sorting

Starter code:

Solutions:
(n, l, r) = (0, -100000000, 1000000000)
(x, y) = ([], [])

def cal(mid):
	mx = 0
	for i in range(n):
		mx = max(mx, (x[i] - mid) ** 2 / (2 * y[i]) + y[i] / 2)
	return mx
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	(x.append(a), y.append(b))
for i in range(1, n):
	if y[i] * y[0] < 0:
		print(-1)
		exit(0)
	if y[i] < 0:
		y[i] *= -1
if y[0] < 0:
	y[0] *= -1
for it in range(100):
	(m1, m2) = (l + (r - l) / 3, r - (r - l) / 3)
	(v1, v2) = (cal(m1), cal(m2))
	if v1 > v2:
		l = m1
	else:
		r = m2
print(cal(m1))


def check(mid):
	mx = 0
	for i in range(n):
		mx = max(mx, (x[i] - mid) ** 2 / (2 * y[i]) + y[i] / 2)
	return mx
n = int(input())
l = -100000000
r = 100000000
x = []
y = []
(c1, c2) = (0, 0)
for i in range(n):
	(a, b) = map(int, input().split())
	if b >= 0:
		c1 += 1
	else:
		c2 += 1
	x.append(a)
	y.append(abs(b))
if c1 and c2:
	print(-1)
	return
for i in range(100):
	m1 = l + (r - l) / 3
	m2 = r - (r - l) / 3
	if check(m1) > check(m2):
		l = m1
	else:
		r = m2
print(check(l))


(l, r) = (-100000000, 1000000000)

def check(mid):
	mx = 0
	for i in range(n):
		(x, y) = (x1[i], y1[i])
		mx = max(mx, (x1[i] - mid) ** 2 / (2 * y1[i]) + y1[i] / 2)
	return mx
n = int(input())
count1 = 0
count2 = 0
x1 = []
y1 = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if b >= 0:
		count1 += 1
	else:
		count2 += 1
	x1.append(a)
	y1.append(abs(b))
if count1 and count2:
	print(-1)
	return
for i in range(100):
	mid1 = l + (r - l) / 3
	mid2 = r - (r - l) / 3
	if check(mid1) > check(mid2):
		l = mid1
	else:
		r = mid2
print(check(l))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def check(m):
	r = -1
	for j in range(n):
		r = max(r, (x[j] - m) ** 2 / (2 * y[j]) + y[j] / 2)
	return r
n = int(input())
x = []
y = []
for j in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
p = 0
q = 0
for j in y:
	if j < 0:
		p = 1
	else:
		q = 1
if p == 1 and q == 1:
	print(-1)
else:
	if p == 1:
		for j in range(n):
			y[j] = abs(y[j])
	l = -10 ** 7
	h = 10 ** 7
	for i in range(200):
		m1 = (3 * l + h) / 4
		m2 = (3 * h + l) / 4
		if check(m1) > check(m2):
			l = m1
		else:
			h = m2
	print(check(l))


def bs(x, y, n, p):
	r = 0
	for i in range(n):
		z = (p - x[i]) * (p - x[i]) + 1.0 * y[i] * y[i]
		z = z / 2.0
		z = z / y[i]
		z = abs(z)
		r = max(z, r)
	return r
n = int(input())
y = []
x = []
k = z = 0
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	if b > 0:
		k = 1
	if b < 0:
		z = 1
	x.append(a)
	y.append(b)
if k == 1 and z == 1:
	print(-1)
else:
	z = 120
	l = min(x)
	rt = max(x)
	while z:
		p1 = (2 * l + rt) / 3
		p2 = (2 * rt + l) / 3
		if bs(x, y, n, p1) < bs(x, y, n, p2):
			rt = p2
		else:
			l = p1
		z = z - 1
	print(bs(x, y, n, l))


import math
n = int(input())
points = []
npt = 0
for i in range(n):
	point = list(map(int, input().split()))
	if point[1] < 0:
		npt += 1
		point[1] = -point[1]
	points.append(point)
if npt < n and npt > 0:
	print(-1)
else:
	(l, r) = (0, 1e+16)
	count = 200
	while abs(r - l) > 1e-06 and count > 0:
		count -= 1
		ok = True
		mid = (l + r) / 2
		(a, b) = (-float('inf'), float('inf'))
		for i in range(n):
			(x, y) = points[i]
			if y > 2 * mid:
				l = mid
				ok = False
				break
			delta = math.sqrt(y * (2 * mid - y))
			(a, b) = (max(a, x - delta), min(b, x + delta))
		if not ok:
			continue
		if a > b:
			l = mid
		else:
			r = mid
	print((l + r) / 2)


from math import sqrt
eps = 1e-09

def mysqrt(x):
	if x <= 0:
		return 0
	return sqrt(x)

def good(R):
	nonlocal xs
	nonlocal ys
	nonlocal n
	left = -10 ** 20
	right = 10 ** 20
	for i in range(n):
		xi = xs[i]
		yi = abs(ys[i])
		D = 2 * R * yi - yi ** 2
		if D + eps < 0:
			return False
		sD = mysqrt(D)
		new_left = xi - sD
		new_right = xi + sD
		left = max(left, new_left)
		right = min(right, new_right)
		if left + eps > right:
			return False
	return True

def solve(lower, high, md):
	R = 0
	for _ in range(150):
		R = md(lower, high)
		if good(R):
			high = R
		else:
			lower = R
	return R
n = int(input())
xs = [0.0 for _ in range(n)]
ys = [0.0 for _ in range(n)]
for i in range(n):
	(xs[i], ys[i]) = list(map(float, input().split()))
	if i > 0:
		if ys[i] * ys[0] < 0:
			print(-1)
			return
R = None
if good(1):
	R = solve(0, 1, lambda x, y: (x + y) / 2)
else:
	R = solve(1, 1e+16, lambda x, y: sqrt(x * y))
print('{:.16}'.format(R))


import sys
input = sys.stdin.readline

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def get(x0, a, n):
	r = 0
	for i in range(n):
		p = (x0 - a[i].x) * (x0 - a[i].x) + 1.0 * a[i].y * a[i].y
		p = p / 2.0 / a[i].y
		if p < 0:
			p = -p
		r = max(r, p)
	return r

def main():
	n = int(input())
	(pos, neg) = (False, False)
	a = []
	for i in range(n):
		(x, y) = map(int, input().split())
		t = Point(x, y)
		if t.y > 0:
			pos = True
		else:
			neg = True
		a.append(t)
	if pos and neg:
		return -1
	if neg:
		for i in range(n):
			a[i].y = -a[i].y
	(L, R) = (-100000000.0, 100000000.0)
	for i in range(120):
		x1 = L + (R - L) / 3
		x2 = R - (R - L) / 3
		if get(x1, a, n) < get(x2, a, n):
			R = x2
		else:
			L = x1
	return get(L, a, n)
print(main())