#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  static int x[500000];
  static int v[500000];
  while (cin >> n) {
    for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &v[i]);
    int first = n;
    int last = -1;
    for (int i = 0; i < n; i++) {
      if (v[i] > 0)
        first = min(first, i);
      else
        last = max(last, i);
    }
    if (last < first) {
      puts("-1");
      continue;
    }
    double L = 0.0, R = 1e10;
    for (int cnt = 0; cnt < 100; cnt++) {
      double mid = 0.5 * (L + R);
      double curMax = x[first] + mid * v[first];
      bool ok = false;
      for (int i = first + 1; i < n; i++) {
        if (v[i] > 0)
          curMax = max(curMax, x[i] + mid * v[i]);
        else {
          double rev = x[i] + mid * v[i];
          if (rev < curMax) ok = true;
        }
      }
      ok ? R = mid : L = mid;
    }
    printf("%.10lf\n", 0.5 * (L + R));
  }
}
