#include <bits/stdc++.h>
using namespace std;
long long int x[500009], v[500009], n;
bool check(double t) {
  double nw = -(long long)((1e31) - 1);
  bool chk = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] > 0)
      nw = max(nw, x[i] + v[i] * t);
    else if (nw >= (x[i] + v[i] * t)) {
      chk = 1;
      goto BPP;
    }
  }
BPP:
  return chk;
}
int main() {
  int i;
  scanf("%d", &n);
  long long int mn = -(long long)((1e31) - 1), mp = (long long)((1e31) - 1);
  for (i = 0; i < n; i++) {
    scanf("%lld %lld", &x[i], &v[i]);
    if (v[i] < 0)
      mn = max(x[i], mn);
    else
      mp = min(x[i], mp);
  }
  if (mn < mp) {
    puts("-1");
    return 0;
  } else if (mn == mp) {
    puts("0");
    return 0;
  }
  double l = 0, h = 1e9, t;
  while ((h - l) >= (double)1e-9 * max(h, 1.0)) {
    t = (l + h) / 2;
    if (check(t))
      h = t;
    else
      l = t;
  }
  t = (l + h) / 2;
  printf("%.15lf\n", t);
}
