#include <bits/stdc++.h>
using namespace std;
pair<int, int> all[500001];
int n;
bool checkCollision(double t) {
  double r_max = -1e19;
  for (int i = 0; i < n; i++) {
    if (all[i].second > 0) r_max = max(r_max, all[i].first + all[i].second * t);
    if (all[i].second < 0)
      if (r_max >= all[i].first + all[i].second * t) return true;
  }
  return false;
}
int main() {
  bool flg = true, ok = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &all[i].first, &all[i].second);
    if (all[i].second > 0 && flg == true) flg = false;
    if (all[i].second < 0 && flg == false) ok = true;
  }
  if (!ok) {
    cout << -1 << endl;
    return 0;
  }
  double a = 0.0;
  double b = 1e9;
  double mid;
  for (int i = 0; i < 60; i++) {
    mid = (a + b) / 2;
    if (checkCollision(mid) == true) {
      b = mid;
    } else {
      a = mid;
    }
  }
  printf("%.10lf\n", (a + b) / 2);
  return 0;
}
