#include <bits/stdc++.h>
using namespace std;
int a[500005][2], n;
bool check(double t) {
  int i;
  double d = -1e20;
  for (i = 0; i < n; i++) {
    if (a[i][1] > 0)
      d = max(d, a[i][0] + t * a[i][1]);
    else if (a[i][0] + t * a[i][1] <= d)
      return true;
  }
  return false;
}
int main() {
  while (~scanf("%d", &n)) {
    int i, t = 0;
    memset(a, 0, sizeof(a));
    for (i = 0; i < n; i++) scanf("%d%d", &a[i][0], &a[i][1]);
    double l = 0, r = 1e10;
    while (t < 100) {
      t++;
      double mid = (l + r) / 2.0;
      if (check(mid))
        r = mid;
      else
        l = mid;
    }
    if (r == 1e10)
      puts("-1");
    else
      printf("%.20lf\n", l);
  }
}
