N,*A=ARGF.read.split.map &:to_i a=*0;b=*0 A.each_slice(2){|x,y|a<