#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<to;x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N; pair<ll,ll> P[1010]; ll val(ll x) { ll ma=0,mi=1LL<<60; int i; if(x<1) return 1LL<<60; FOR(i,N) ma=max(ma,P[i].first*x+P[i].second); FOR(i,N) mi=min(mi,P[i].first*x+P[i].second); return ma-mi; } void solve() { int i,j,k,l,r,x,y; string s; cin>>N; FOR(i,N) { cin>>x>>y; P[i]=make_pair(y,x); } ll ret=1; ll L=1,R=1LL<<30; ll mi=val(L); FOR(i,200) { ll m1=(L*2+R)/3; ll m2=(L+R*2)/3; ll v1=val(m1); ll v2=val(m2); if(v1<mi || (v1==m1&&ret>m1)) ret=m1,mi=v1; if(v2<mi || (v1==m1&&ret>m2)) ret=m2,mi=v2; if(v1==v2) L=m1, R=m2; else if(v1<v2) R=m2; else L=m1; } for(x=L-10;x<=L+100;x++) { ll v=val(x); if(v<mi || (v==mi&&ret>x)) ret=x,mi=v; } for(x=R-100;x<=R+10;x++) { ll v=val(x); if(v<mi || (v==mi&&ret>x)) ret=x,mi=v; } cout<<ret<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }