#include <bits/stdc++.h>
using namespace std;
double x[500005], v[500005];
int main() {
  int n;
  bool can = false;
  scanf("%d", &n);
  double t, l = 0, r = -1, m, x1, v1 = 0, L;
  for (int i = 0; i < n; ++i) {
    scanf("%lf%lf", &x[i], &v[i]);
    if (v[i] < 0) {
      if (v1 != 0) {
        can = true;
        t = (x[i] - x1) / (v1 - v[i]);
        if (r == -1 || t < r) r = t;
      }
    } else
      x1 = x[i], v1 = v[i];
  }
  if (!can) {
    puts("-1");
    return 0;
  }
  int cnt = 0;
  while (r - l >= 1e-10 && ++cnt <= 100) {
    m = (l + r) / 2;
    v1 = 0;
    can = false;
    for (int i = 0; i < n; ++i) {
      if (v[i] < 0) {
        if (v1 != 0 && x[i] + v[i] * m <= L) {
          can = true;
          break;
        }
      } else {
        t = x[i] + v[i] * m;
        if (v1 == 0 || t > L) L = t;
        v1 = v[i];
      }
    }
    if (can)
      r = m;
    else
      l = m;
  }
  cout << setprecision(25) << l << endl;
}
