#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000, inf = 1000000000;
vector<pair<int, int> > l, r;
bool acc(double t) {
  double mx = -1e10;
  int pl = 0, pr = 0;
  while (pr < r.size()) {
    while (pl < l.size() && l[pl].first <= r[pr].first) {
      mx = max(double(mx), double(l[pl].first + l[pl].second * t));
      pl++;
    }
    if (r[pr].first + r[pr].second * t < mx) return true;
    pr++;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(20);
  int n, x, y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (y < 0)
      r.push_back(make_pair(x, y));
    else
      l.push_back(make_pair(x, y));
  }
  sort(r.begin(), r.end());
  sort(l.begin(), l.end());
  if (!l.size() || !r.size() || r[r.size() - 1].first < l[0].first) {
    cout << -1 << endl;
    return 0;
  }
  double r = 1e10, l = 0, ans;
  for (int i = 0; i < 100; i++) {
    double mid = (l + r) / 2;
    if (acc(mid))
      r = mid;
    else
      l = mid;
  }
  cout << (l + r) / 2 << endl;
}
