#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e5 + 10;
const long long ZERO = 0;
const long long SADAT = 7.84e-17;
const long long INF = 1e10;
int n;
int v[maxn], x[maxn];
double l = 0, r = 1e10, m, ma;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> v[i];
  }
  for (int i = 0; i < 66; i++) {
    m = (l + r) / 2.0;
    bool f = false;
    ma = -1e40;
    for (int j = 0; j < n; j++) {
      double d = m * v[j] + x[j];
      if (v[j] > 0)
        ma = max(ma, d);
      else if (d <= ma) {
        f = true;
        break;
      }
    }
    if (f)
      r = m;
    else
      l = m;
  }
  if (r >= 1e10) {
    cout << -1;
    return (0);
    ;
  } else
    cout << fixed << setprecision(10) << (l + r) / 2;
  return (0);
}
