N=gets.to_i r=Float::INFINITY t=0 c=[] N.times{ a,b=gets.split.map &:to_i t+=a c<0&&s+=c[j]} q1<0&&s+=c[N/2+j]} q2<=t-e}||q2.size f_=([fidx-1,fidx]-[-1,q2.size]).map{|i|q2[i]} f_.each{|f|r=[r,(t-e-f).abs].min} } p r