#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 7;
vector<long long> v[MX];
bool vis[MX];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  pair<long long, long long> p[n];
  for (long long i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  long double l = 0, r = 1e10;
  for (long long i = 0; i < 100; i++) {
    long long cnt;
    long double mid = (l + r) / 2, d = -1e20;
    for (cnt = 0; cnt < n; cnt++) {
      if (p[cnt].second > 0)
        d = max(d, p[cnt].first + mid * p[cnt].second);
      else if (p[cnt].first + mid * p[cnt].second <= d)
        break;
    }
    if (cnt < n)
      r = mid;
    else
      l = mid;
  }
  if (r == 1e10)
    cout << -1;
  else
    cout << fixed << setprecision(18) << l;
}
