You have n devices that you want to use simultaneously.

The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored. All devices can store an arbitrary amount of power.

You have a single charger that can plug to any single device. The charger will add p units of power per second to a device. This charging is continuous. That is, if you plug in a device for λ seconds, it will gain λ·p units of power. You can switch which device is charging at any arbitrary unit of time (including real numbers), and the time it takes to switch is negligible.

You are wondering, what is the maximum amount of time you can use the devices until one of them hits 0 units of power.

If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power.

Input

The first line contains two integers, n and p (1 ≤ n ≤ 100 000, 1 ≤ p ≤ 109) — the number of devices and the power of the charger.

This is followed by n lines which contain two integers each. Line i contains the integers ai and bi (1 ≤ ai, bi ≤ 100 000) — the power of the device and the amount of power stored in the device in the beginning.

Output

If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power.

Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4.

Namely, let's assume that your answer is a and the answer of the jury is b. The checker program will consider your answer correct if <image>.

Examples

Input

2 1
2 2
2 1000


Output

2.0000000000

Input

1 100
1 1


Output

-1


Input

3 5
4 3
5 2
6 1


Output

0.5000000000

Note

In sample test 1, you can charge the first device for the entire time until it hits zero power. The second device has enough power to last this time without being charged.

In sample test 2, you can use the device indefinitely.

In sample test 3, we can charge the third device for 2 / 5 of a second, then switch to charge the second device for a 1 / 10 of a second.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Sorting

Mathematics


Solutions:
from sys import stdin, stdout
from decimal import *

def ri():
	return map(int, input().split())
(n, p) = ri()
p = Decimal(p)
a = [Decimal(0) for i in range(n)]
b = [Decimal(0) for i in range(n)]
ab = [[Decimal(0), Decimal(0)] for i in range(n)]
A = [Decimal(0) for i in range(n)]
B = [Decimal(0) for i in range(n)]
for i in range(n):
	(aa, bb) = ri()
	ab[i][0] = Decimal(aa)
	ab[i][1] = Decimal(bb)
ab.sort(key=lambda e: e[1] / e[0])
for i in range(n):
	a[i] = Decimal(ab[i][0])
	b[i] = Decimal(ab[i][1])
if p >= sum(a):
	print(-1)
	exit()
A[0] = Decimal(0)
B[0] = Decimal(1)
for i in range(1, n):
	A[i] = a[i] - b[i] * a[i - 1] / b[i - 1] + b[i] * A[i - 1] / b[i - 1]
	B[i] = b[i] * B[i - 1] / b[i - 1]
sigmaA = Decimal(0)
sigmaB = Decimal(0)
for i in range(0, n):
	sigmaA += A[i]
	sigmaB += B[i]
	p0 = Decimal(p - sigmaA) / Decimal(sigmaB)
	if Decimal(a[0] - p0) <= 0:
		continue
	t = Decimal(b[0]) / Decimal(a[0] - p0)
	if i != n - 1 and t <= Decimal(b[i + 1] / a[i + 1]) and (t > 0):
		print(t)
		exit()
print(t)


from math import inf
(n, p) = [int(x) for x in input().split()]
l = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	l.append((a, b, b / a))
l.sort(key=lambda x: x[2])
asum = 0
bsum = 0
sumt = 0
for i in range(n):
	(a0, b0, _) = l[i]
	c1 = inf if i == n - 1 else l[i + 1][2]
	asum += a0
	bsum += b0
	dp = asum - p
	if dp > 0:
		t = bsum / dp
		if t < c1:
			print(t)
			exit()
print(-1)


(n, p) = map(int, input().split())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append((a, b, b / a))
l.sort(key=lambda x: x[2])
(sum_a, sum_b, sumt) = (0, 0, 0)
for i in range(n):
	(a, b, _) = l[i]
	c = 1e+18 if i == n - 1 else l[i + 1][2]
	sum_a += a
	sum_b += b
	dp = sum_a - p
	if dp > 0 and sum_b / dp < c:
		print(sum_b / dp)
		exit()
print(-1)


def check(t):
	global a, b, p, n
	x = 0
	for i in range(n):
		x += max(0, t * a[i] - b[i])
	return x / t <= p
(n, p) = map(int, input().split())
p = float(p)
(a, b) = ([0 for i in range(n)], [0 for i in range(n)])
s = 0
for i in range(n):
	(a[i], b[i]) = map(float, input().split())
	s += a[i]
if s <= p:
	print(-1)
else:
	l = 0
	r = 10 ** 10 + 1
	j = 0
	while r - l > 10 ** (-4):
		m = (l + r) / 2
		if check(m):
			l = m
		else:
			r = m
		j += 1
	print(l)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
(n, p) = M()
la = []
s = 0

def check(mid):
	w = 0
	for i in range(n):
		q = max(0, mid * la[i][0] - la[i][1])
		w += q
	if w <= p * mid:
		return True
	return False
for _ in range(n):
	(a, b) = M()
	la.append((a, b))
	s += a
if p >= s:
	print(-1)
else:
	l = 0
	h = 1
	while check(h):
		l = h
		h *= 10
	while h - l > 1:
		mid = (l + h) // 2
		if check(mid):
			l = mid
		else:
			h = mid
	for j in range(100):
		mid = (l + h) / 2
		if check(mid):
			l = mid
			key = mid
		else:
			h = mid
	print(key)


(n, p) = [int(x) for x in input().split()]
a = []
pl = 0
pn = 0
t = 0
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	a += [(x, y / x)]
a.sort(key=lambda x: x[1])
(pn, t) = (0, a[0][1])
pl = t * p
for i in range(1, n):
	(ec, et) = (a[i - 1][0], a[i][1])
	pn += ec
	ts = et - t
	if pn * ts <= pl + p * ts:
		pl += p * ts - pn * ts
		t = et
	else:
		print(t + pl / (pn - p))
		break
else:
	pn += a[-1][0]
	if pn <= p:
		print(-1)
	else:
		print(t + pl / (pn - p))


n__power = input().split()
n = int(n__power[0])
power = int(n__power[1])
items = []
for _ in range(n):
	p__a = input().split()
	p = int(p__a[0])
	a = int(p__a[1])
	time = a / p
	items.append((time, p, a))
items.sort()
sys_power = -power
sys_amount = 0
sys_time = None
while len(items) > 0:
	(t, p, a) = items.pop(0)
	if sys_time is not None and sys_time < t:
		break
	sys_power += p
	sys_amount += a
	if sys_power > 0:
		sys_time = sys_amount / sys_power
if sys_time is None:
	print('-1')
else:
	print(sys_time)


from sys import stdin, stdout
(n, p) = map(int, stdin.readline().rstrip().split())
powerData = []
powerList = []
for i in range(n):
	(a, b) = map(int, stdin.readline().rstrip().split())
	deathTime = b / a
	powerData.append((a, b, deathTime))
	powerList.append(a)
powerData.sort(key=lambda x: x[2])
if sum(powerList) <= p:
	print(-1)
else:
	i = 0
	combinedPower = 0
	startingPower = 0
	while combinedPower <= p:
		combinedPower += powerData[i][0]
		startingPower += powerData[i][1]
		i += 1
	finished = False
	deathTime = startingPower / (combinedPower - p)
	while i < n and deathTime > powerData[i][2]:
		combinedPower += powerData[i][0]
		startingPower += powerData[i][1]
		deathTime = startingPower / (combinedPower - p)
		i += 1
	print(deathTime)


def solve():
	(n, p) = map(int, input().split())
	persec = []
	cur = []
	for i in range(n):
		(a, b) = map(int, input().split())
		persec.append(a)
		cur.append(b)
	if sum(persec) <= p:
		print(-1)
		return
	full_time = 0
	curtime = [cur[i] / persec[i] for i in range(len(cur))]
	ids = list(range(len(cur)))
	ids.sort(key=lambda i: curtime[i])
	cur_next = 0
	powered_minus = 0
	additional_energy = 0
	while True:
		if cur_next < len(ids):
			curmin = curtime[ids[cur_next]] - full_time
			next_time = curmin * (p - powered_minus)
			if additional_energy > -next_time:
				additional_energy += curmin * (p - powered_minus)
				full_time += curmin
				powered_minus += persec[ids[cur_next]]
				cur_next += 1
				continue
		full_time += additional_energy / (powered_minus - p)
		break
	print('%.9f' % full_time)
solve()


if 1:
	(N, P) = [int(i) for i in input().split()]
	p = []
	b = []
	for _ in range(N):
		(pp, bb) = [int(i) for i in input().split()]
		p.append(pp)
		b.append(bb)
else:
	(N, P) = (10000, 999999999)
	p = [100000] * N
	b = [100000] * N
sp = sum(p)
sb = sum(b)
if P >= sp:
	print(-1)
else:
	ep = sp - P
	hi = sb / ep
	lo = 0
	while lo + 1e-05 < hi:
		t = (lo + hi) / 2
		tp = 0
		for i in range(N):
			mp = t * p[i]
			tp += min(mp, b[i])
		if tp < t * ep:
			hi = t
		else:
			lo = t
	print(hi)