N=int(input()) AB=[tuple(map(int,input().split())) for i in range(N)] def calc(x): MIN=1<<64 MAX=-1<<64 for a,b in AB: MIN=min(a+x*b,MIN) MAX=max(a+x*b,MAX) return MAX-MIN MIN=1 MAX=10**18 while MAX>MIN+10: x=MIN+(MAX-MIN)//3 y=MIN+(MAX-MIN)//3*2 if calc(x)>calc(y): MIN=x else: MAX=y SCORE=1<<64 for i in range(MIN,MAX+1): if calc(i)