eval'N,M,*D='+$<.read.split*?, D.sort! p (N..M).map{|i|x,y=D[i-N],D[i-1];y<0?-x:x>0?y:y-x+[y,-x].min}.min