#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int n;
int num[500005];
int x[500005], v[500005];
long double c[500005];
bool ok(long double t) {
  for (int i = 0; i < int(n); i++) {
    c[i] = x[i] + v[i] * t;
  }
  long double mx = -2e+9;
  ;
  for (int i = 0; i < int(n); i++) {
    if (v[i] > 0) {
      if (c[i] > mx) mx = c[i];
    } else {
      if (mx > c[i]) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < int(n); i++) {
    scanf("%d %d", &x[i], &v[i]);
  }
  bool f = false;
  for (int i = 0; i < int(n - 1); i++) {
    if (v[i] > 0 && v[i + 1] < 0) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < int(n); i++) {
    num[i] = i;
  }
  long double L = 0, R = 2.5e+9;
  for (int it = 0; it < int(105); it++) {
    long double mid = (L + R) / 2;
    if (ok(mid))
      L = mid;
    else
      R = mid;
  }
  cout.precision(15);
  cout << fixed;
  cout << (L + R) / 2 << endl;
  return 0;
}
