#include <bits/stdc++.h>
using namespace std;
double maxd = 99999999999;
vector<pair<int, int> > parts;
bool check(double T) {
  double anterior;
  double lala = -maxd;
  for (int i = 0; i < parts.size(); i++) {
    double postpos = parts[i].first + ((double)parts[i].second) * T;
    if (parts[i].second > 0 && postpos > lala) {
      lala = postpos;
    } else if (postpos <= lala && parts[i].second < 0) {
      return true;
    }
  }
  return false;
}
int main() {
  int ps;
  scanf("%d", &ps);
  int bigbang = 2;
  while (ps--) {
    int x, v;
    scanf("%d %d", &x, &v);
    parts.push_back(make_pair(x, v));
    if (v > 0 && bigbang == 2)
      bigbang--;
    else if (v < 0 && bigbang == 1)
      bigbang--;
  }
  if (bigbang != 0) {
    cout << -1;
    return 0;
  }
  double ini = 0, end = 1000000000 + 1;
  if (!check(end)) {
    cout << -1;
    return 0;
  }
  double last = 2000000001;
  while (true) {
    double value = (end + ini) / 2;
    bool b = check(value);
    if (fabs(value - last) < 0.000000001) {
      printf("%.10f", value);
      return 0;
    }
    if (!b) {
      ini = value;
    }
    if (b) {
      end = value;
    }
    last = value;
  }
  return 0;
}
