#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<double, double> > vec(n, pair<double, double>(0, 0));
  for (int i = 0; i < n; ++i) {
    int a, v;
    cin >> a >> v;
    vec[i] = pair<double, double>(a, v);
  }
  int ver = 0;
  double ini = 0, fin = 1e9;
  for (int i = 0; i < n - 1; ++i) {
    if (vec[i].second > 0 && vec[i + 1].second < 0) ver = 1;
  }
  if (ver == 0) {
    cout << -1 << "\n";
    return 0;
  }
  for (int i = 0; i < 65; ++i) {
    double med = (ini + fin) / 2.0;
    double maxD = -1e9, maxI = 1e9;
    vector<double> reg(n, -1);
    for (int j = 0; j < n - 1; ++j) {
      if (vec[j].second < 0) continue;
      double pos = vec[j].first + vec[j].second * med;
      if (pos > maxD) {
        maxD = pos;
      }
      if (vec[j + 1].second < 0) {
        reg[j] = maxD;
        maxD = -1e9;
      }
    }
    for (int j = n - 1; j >= 1; --j) {
      if (vec[j].second > 0) continue;
      double pos = vec[j].first + vec[j].second * med;
      if (pos < maxI) {
        maxI = pos;
      }
      if (vec[j - 1].second > 0) {
        reg[j] = maxI;
        maxI = 1e9;
      }
    }
    int ver = 0;
    for (int j = 0; j < n - 1; ++j) {
      if (reg[j] == -1 || reg[j + 1] == -1) continue;
      if (reg[j] - reg[j + 1] >= 0.0) {
        ver = 1;
        ++j;
      }
    }
    if (ver)
      fin = med;
    else
      ini = med;
  }
  cout << fixed << setprecision(10);
  cout << fin << "\n";
  return 0;
}
