#include <bits/stdc++.h>
using namespace std;
const int NICO = 500000 + 10;
int n, d[NICO], sum[NICO];
long long a[NICO], v[NICO];
double p[NICO];
bool ok(long double x) {
  double mx = -1e20;
  for (int i = 1; i <= n; i++) {
    p[i] = a[i] + v[i] * x;
    if (v[i] > 0) {
      if (p[i] > mx) mx = p[i];
    } else if (p[i] < mx) {
      return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld", &a[i], &v[i]);
    if (v[i] > 0) d[i] = 1;
    sum[i] = sum[i - 1] + d[i];
  }
  long double L = 0, R = 2000000000;
  for (int i = 1; i <= 70; i++) {
    long double mid = (L + R) / 2;
    if (ok(mid)) {
      R = mid;
    } else {
      L = mid;
    }
  }
  if (!ok(2000000000)) {
    printf("-1\n");
    return 0;
  }
  printf("%.12f\n", (double)(L + R) / 2);
}
