#include <bits/stdc++.h>
using namespace std;
long long x[500005], v[500005];
signed main() {
  long long n;
  cin >> n;
  long long le = 1, ri = n;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld %lld", &x[i], &v[i]);
  }
  double l = 0, r = 1e9 + 1;
  while (l + 1e-9 <= r) {
    bool bigbang = 0;
    double mid = (l + r) / 2;
    double ma = -1e40;
    for (long long i = 1; i <= n; i++) {
      if (v[i] > 0 && x[i] + mid * v[i] > ma) {
        ma = x[i] + mid * v[i];
      }
      if (v[i] < 0 && x[i] + mid * v[i] <= ma) {
        bigbang = 1;
        break;
      }
    }
    if (bigbang)
      r = mid;
    else
      l = mid + 1e-9;
  }
  if (l <= 1000000001.0)
    printf("%.15f", l);
  else
    cout << -1;
}
