#include <bits/stdc++.h>
using namespace std;
const long double oo = 1e9 + 10;
const int N = 5e5 + 2;
int n, rep = 80, x[N], v[N];
bool flag;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> v[i];
  long double st = 0, ed = oo;
  while (rep--) {
    long double t = (st + ed) / 2, mx = -1e20;
    flag = false;
    for (int i = 0; i < n; i++)
      if (v[i] > 0)
        mx = max(mx, x[i] + t * v[i]);
      else if (x[i] + t * v[i] <= mx) {
        flag = true;
        break;
      }
    (flag ? ed : st) = t;
  }
  cout << fixed << setprecision(10) << (ed <= 1e9 ? ed : -1) << '\n';
  return 0;
}
