#include <bits/stdc++.h>
using namespace std;
int x[500010];
int v[500010];
int n;
bool ok(double m) {
  double d = -2000000000.0;
  for (int i = 0; i < n; ++i) {
    if (v[i] < 0) {
      if (d > -1100000000.0) {
        if (m * v[i] + x[i] <= d) return true;
      }
    } else {
      d = max(d, (double)x[i] + m * v[i]);
    }
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", &x[i], &v[i]);
  double left = 0.0, right = 2000000000.0;
  for (int i = 0; i < 100; ++i) {
    double mid = (left + right) / 2;
    if (ok(mid))
      right = mid;
    else
      left = mid;
  }
  if (left > 1100000000.0)
    printf("-1\n");
  else
    printf("%.12lf\n", left);
  return 0;
}
