#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
const long double INF = 1e9 + 7;
long long x[MAXN], v[MAXN], n;
bool check(long double mid) {
  long double maxs = -1e100;
  for (int i = 0; i < n; ++i) {
    if (v[i] > 0)
      maxs = max(maxs, x[i] + v[i] * mid);
    else if (x[i] + v[i] * mid <= maxs)
      return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> v[i];
  }
  long double l = 0, r = 1e15;
  int t = 100;
  while (t != 0) {
    long double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
    --t;
  }
  if (!check(r)) {
    cout << fixed << setprecision(10) << "-1.0000000";
  } else
    cout << fixed << setprecision(10) << r;
}
