#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define int ll using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i<ll(b); i++) #define rep(i,b) loop(i,0,b) #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple template<class T> ostream & operator<<(ostream & os, vector<T> const &); template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){} template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); } template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; } template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl) #else #define dump(...) #endif int sign(int x){ if(x==0) return 0; return x < 0 ? -1 : 1; } int inf = LLONG_MAX; int N; int a[2000],b[2000],v[2000]; int solve(int x){ rep(i,N) v[i] = a[i]+b[i]*x; int M = v[0], m = v[0]; rep(i,N){ M = max(M,v[i]); m = min(m,v[i]); } if(x==1){ dump(v); } return M-m; } signed main(){ while(cin >> N){ rep(i,N) cin >> a[i] >> b[i]; pair<int,int> ans = mp(solve(1),1); dump(ans); rep(i,N)rep(j,i){ int a1,a2,b1,b2; tie(a1,b1) = tie(a[i],b[i]); tie(a2,b2) = tie(a[j],b[j]); if(sign(a1-a2) == sign(b1-b2) || sign(b1-b2) == 0) continue; double x = - (a1-a2) / (b1-b2); for(int d=-1;d<=1;d++){ int xx = ceil(x+d); if(xx <= 0) xx = 1; int t = solve(xx); ans = min(ans,mp(t,xx)); } dump(ans); } // if(ans == inf) ans = 1; cout << ans.second << endl; } }