#!/usr/bin/env python3 # This fails because if the mill are super-efficient, # the binary search is never entered (since the processing # time is less than the float_tolerance). # Consequently, mid never gets a value, and pandemonium ensues n, w = map(int, input().split()) mills = [tuple(map(int, input().split())) for _ in range(n)] lo = 2 # upper bound: send everything to the first mill hi = 2 * mills[0][1] + w / mills[0][0] while hi - lo > 10**(-6): mid = (lo + hi) / 2 if sum(proces * (mid - 2 * travel) for proces, travel in mills if 2 * travel < mid) >= w: hi = mid else: lo = mid print(mid)