#include <bits/stdc++.h>
using namespace std;
int x[500000], v[500000];
double y[500000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &v[i]);
  double m = 0, M = 1e10;
  int dir = 0, pos = 0;
  for (int i = 0; i + 1 < n; i++) {
    if (v[i] > 0 && v[i + 1] < 0) pos = 1;
  }
  if (!pos) {
    printf("%lf\n", -1.0);
    return 0;
  }
  for (int it = 0; it < 200; it++) {
    double t = (m + M) / 2;
    for (int i = 0; i < n; i++) y[i] = x[i] + t * v[i];
    int ok = 0;
    for (int i = 0; i < n;) {
      if (v[i] < 0) {
        i++;
        continue;
      }
      int j = i + 1;
      while (j < n && (v[j] < 0 || y[j] < y[i])) {
        if (v[j] < 0 && y[j] < y[i]) {
          ok = 1;
          i = n;
          break;
        }
        j++;
      }
      i = j;
    }
    if (ok) {
      M = t;
    } else {
      m = t;
    }
  }
  printf("%.12lf\n", m);
  return 0;
}
