#include #include #include #include #include #include #include #include #include #include using namespace std; typedef vector VI; typedef vector VVI; typedef vector VS; typedef pair PII; typedef long long LL; typedef unsigned long long ULL; typedef pair PIL; typedef vector VPIL; #define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define sort(c) sort((c).begin(),(c).end()) #define range(i,a,b) for(int i=(a); i < (b); i++) #define rep(i,n) range(i,0,n) #define MAX_INT 2147483647 #define MAX_F 1000000000000 pair func(LL x, LL tmp_x, LL f_x, int a[], int b[], int N){ LL max_f = 0, min_f = MAX_F, f_tmpx; rep(i,N){ f_tmpx = a[i]+b[i]*tmp_x; max_f = max(max_f, f_tmpx); min_f = min(min_f, f_tmpx); } f_tmpx = max_f - min_f; if(f_tmpx < f_x || (f_tmpx == f_x && tmp_x < x)) return pair (tmp_x,f_tmpx); else return pair (x,f_x); } int main(){ int N; pair res; LL tmp_x; cin >> N; int a[N], b[N]; rep(i,N){cin >> a[i] >> b[i];} res = func(1,1,MAX_F,a,b,N); rep(i,N-1) range(j,i+1,N){ if(b[i]==b[j]) continue; tmp_x = - (a[i] - a[j])/(b[i]-b[j]); if (tmp_x < 1) continue; res = func(res.first,tmp_x,res.second,a,b,N); if (abs(a[i] - a[j])%abs(b[i]-b[j]) > 0){ res = func(res.first,tmp_x+1,res.second,a,b,N); } } cout << res.first << endl; return 0; }