import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def main(): def isl(m): mx0 = mx1 = 0 mn0 = mn1 = inf for a, b in zip(aa, bb): v = a + b * (m - 1) if v > mx0: mx0 = v if v < mn0: mn0 = v v = a + b * m if v > mx1: mx1 = v if v < mn1: mn1 = v return mx0 - mn0 > mx1 - mn1 def f(x): mx = 0 mn = inf for a, b in zip(aa, bb): v = a + b * x if v > mx: mx = v if v < mn: mn = v return mx - mn inf = 10 ** 9 + 1 n = II() aa = [] bb = [] for _ in range(n): a, b = MI() aa.append(a) bb.append(b) # y=a+bxとして、f(x)=max(y)-min(y)は下に凸の関数になる # 下に凸の関数の最小値は三分探索が一般的だが、今回はxが整数という制約があるので二分探索でいける # あるx1と、その左隣のx0(つまりx0=x1-1)があったとき # f(x0)>f(x1)となれば最小値をとるxはもっと右 # そうでなければ最小値をとるxはもっと左となる l = 0 r = inf while l + 1 < r: m = (l + r) // 2 if isl(m): l = m else: r = m # 一応lrの前後を含めて確認 mn = inf ans = l for x in range(max(1, l - 1), r + 2): v = f(x) if v < mn: ans = x mn = v print(ans) main()