#include #include #include #include #include #include #include #include #include // require sort next_permutation count __gcd reverse etc. #include // require abs exit atof atoi #include // require scanf printf #include #include // require accumulate #include // require fabs #include #include #include #include // require setw #include // require stringstream #include // require memset #include // require tolower, toupper #include // require freopen #include // require srand #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() #define each(i,c) for(auto i=(c).begin();i!=(c).end();++i) #define exist(s,e) ((s).find(e)!=(s).end()) #define clr(a) memset((a),0,sizeof(a)) #define nclr(a) memset((a),-1,sizoef(a)) #define sz(s) (int)((s).size()) #define INRANGE(x,s,e) ((s)<=(x) && (x)<(e)) #define pb push_back #define MP(x,y) make_pair((x),(y)) #define INF (ll)1e8 #define INF2 1e100 using namespace std; typedef long long ll; typedef pair P; double fx (vector a, vector b, ll x ){ int n = a.size(); double maxs = 0.; double mins = INF2; rep (i, n ){ maxs = max (maxs, (double)(a[i] + x*b[i] ) ); mins = min (mins, (double)(a[i] + x*b[i] ) ); } // end rep return (maxs - mins ); } ll fx2 (vector a, vector b, ll x ){ int n = a.size(); ll maxs = 0LL; ll mins = 1LL<<60; rep (i, n ){ maxs = max (maxs, (ll)a[i] + x*(ll)b[i] ); mins = min (mins, (ll)a[i] + x*(ll)b[i] ); } // end rep return (maxs - mins ); } int main() { ios_base::sync_with_stdio(0); int N; cin >> N; vector a(N, 0 ), b (N, 0 ); rep (i, N ){ cin >> a[i] >> b[i]; } // end rep ll lo = 1LL; ll hi = 1LL<<30; ll res = 0LL; int cnt = 1000; while (cnt-- ){ ll cl = lo + (hi - lo)/3LL; ll cr = lo + 2LL*(hi - lo)/3LL; if (fx(a,b,cl) < fx(a,b,cr ) ){ res = cl; hi = cr; }else if (fx (a, b, cl ) > fx(a, b, cr ) ){ res = cr; lo = cl; }else{ res = cl; break; } // end if } // end while if (cnt == 999 ) hi = lo; // cerr << "lo: " << lo << " hi: " << hi << endl; double curr = 1LL<<60; for (ll x = lo;x <= hi; x++ ){ if (curr > fx2(a,b,x ) ){ res = x; curr = fx2(a,b,x ); } // end if } // end for cout << res << endl; return 0; }