#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 10;
int n;
int v[MAXN], x[MAXN];
long double x2[MAXN];
bool f(long double T) {
  long double MA = -1e18;
  bool F = 0;
  for (int i = 0; i < n; i++) {
    x2[i] = x[i] + (T * v[i]);
    if (v[i] > 0) {
      MA = max(MA, x2[i]);
      F = 1;
    } else {
      if (F && MA >= x2[i]) {
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cout << fixed << setprecision(15);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> v[i];
  }
  if (f(1e9 + 1) == 0) {
    return cout << -1, 0;
  }
  long double d = 0, up = 1e9 + 1;
  while (up / d - 1 > 1e-9) {
    long double mid = (up + d) / 2;
    if (f(mid)) {
      up = mid;
    } else {
      d = mid;
    }
  }
  cout << (up + d) / 2;
  return 0;
}
