#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define SZ(a) int((a).size()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define DEBUG(x) cout<<#x<<": "< P; typedef long long int LL; typedef pair LP; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector a(N); vector b(N); int maxa = -1; REP(i,N){ cin >> a[i] >> b[i]; maxa = max(maxa, a[i]); } int l = 0, r = maxa; while(l+1 < r){ int m = (l+r) / 2; int min0 = INT_MAX, max0 = -1; int min1 = INT_MAX, max1 = -1; REP(i,N){ min0 = min(min0, a[i] + m*b[i]); max0 = max(max0, a[i] + m*b[i]); min1 = min(min1, a[i] + (m+1)*b[i]); max1 = max(max1, a[i] + (m+1)*b[i]); } int f = (max1-min1) - (max0-min0); if(f <= 0){ l = m; }else{ r = m; } } cout << max(r,1) << endl; return 0; }