#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int *x = new int[500000];
  int *v = new int[500000];
  int fr = n, ll_ = -1;
  bool right = false, left = false;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x[i], &v[i]);
    v[i] > 0 ? fr = min(fr, i) : ll_ = max(ll_, i);
  }
  if (fr > ll_) {
    cout << -1 << endl;
    return 0;
  }
  long double l = 0, r = 1e9, m, last;
  for (int t = 0; t < 600; ++t) {
    last = -1e50;
    m = (r + l) / 2;
    bool ok = false;
    for (int i = 0; i < n; ++i) {
      if (v[i] > 0)
        last = max(last, m * v[i] + x[i]);
      else {
        if (m * v[i] + x[i] < last) {
          ok = true;
          break;
        }
      }
    }
    ok ? r = m : l = m;
  }
  printf("%0.12lf\n", l);
  return 0;
}
