#include <bits/stdc++.h>
using namespace std;
long double a[(1000000)], x[(1000000)];
long double b[(1000000)], y[(1000000)];
int n, A, B;
long double ans;
const long double inf = 3e9;
bool check(double t) {
  int k = B;
  long double cnt = inf * inf;
  for (int i = A; i > 0; i--) {
    while (k && y[k] >= x[i]) {
      cnt = min(cnt, y[k] + t * b[k]);
      k--;
    }
    if (x[i] + t * a[i] >= cnt) return true;
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    double P, V;
    scanf("%lf%lf", &P, &V);
    if (V < 0.) {
      B++;
      y[B] = P;
      b[B] = V;
    } else {
      A++;
      x[A] = P;
      a[A] = V;
    }
  }
  double l = 0., r = inf;
  ans = -1;
  for (int T = 0; T < 100; T++) {
    double mid = (l + r) / 2.;
    if (check(mid)) {
      ans = mid;
      r = mid;
    } else
      l = mid;
  }
  if (ans < 0.)
    puts("-1");
  else {
    cout.precision(10);
    cout << fixed;
    cout << ans << endl;
  }
  return 0;
}
