#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<int, int> a[555555];
  double n, k, t, l = -1, r = 1e12, c, maxx, yes = 0;
  int i;
  cin >> n;
  for (i = 0; i < n; i++) scanf("%d%d", &a[i].first, &a[i].second);
  for (k = 0; k < 300; k++) {
    maxx = -1e30;
    c = (l + r) * 0.5;
    t = 0;
    for (i = 0; i < n; i++)
      if (a[i].second > 0)
        maxx = max(maxx, a[i].first + a[i].second * c);
      else if (maxx >= a[i].first + a[i].second * c) {
        t = 1;
        break;
      }
    if (t) {
      yes = 1;
      r = c;
    } else
      l = c;
  }
  cout.precision(20);
  if (yes == 0) r = -1;
  cout << r;
  return 0;
}
