#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[500005];
int cnt, val;
bool check(double x) {
  double rfrom = 1e9 + 7, rto = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    if (a[i].second >= 0) {
      if (rfrom == 1e9 + 7 || rto < a[i].first)
        rfrom = a[i].first, rto = a[i].first + (a[i].second * x);
      else
        rto = max(rto, a[i].first + (a[i].second * x));
    } else {
      if (a[i].first + (a[i].second * x) <= rto && rfrom != 1e9 + 7) return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a, a + n);
  double l = 0, h = 1e18, mid, ans = -1;
  for (int i = 0; i <= 200; i++) {
    mid = (l + h) / 2.0;
    if (check(mid))
      h = mid, ans = mid;
    else
      l = mid;
  }
  if (ans < 0)
    printf("-1\n");
  else
    printf("%.9f\n", ans);
  return 0;
}
