N=gets.to_i T=(1..N).map{gets.split.map(&:to_i)} def f(w) n,x=T.map{|a,b|a+b*w}.minmax x-n end l=1 r=1000000000 while l+2