#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) #define loop(i,a,n) for(int i=a;i<(n);i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed< vi; typedef vector vs; typedef pair pii; int gcd(int a, int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a, int b){ return a*b/gcd(a,b); } int n; vi a,b; int f(int x){ int ma = 0,mi = (ll)INF*INF; rep(i,n){ ma = max(ma,a[i]+b[i]*x); mi = min(mi,a[i]+b[i]*x); } return ma-mi; } signed main(void) { int i,j; cin >> n; a = b = vi(n); rep(i,n) cin >> a[i] >> b[i]; int lb = 1, ub = INF; rep(_,100){ int m1 = (lb+lb+ub)/3; int m2 = (lb+ub+ub)/3; if(f(m1) <= f(m2)) ub = m2; else lb = m1-1; } //cout << lb << " " << ub << endl; int ans = INF; int x; loop(i,lb,ub+1){ int t = f(i); if(ans > t){ x = i; ans = t; } } cout << x << endl; }