#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 9;
struct Node {
  double st, ed, dir;
} p[N];
struct flag {
  double num, id;
} q[N];
bool cmp(flag a, flag b) { return a.num < b.num; }
int main() {
  int n, m, i, j, k;
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; ++i) {
      scanf("%lf%lf", &p[i].st, &p[i].dir);
    }
    double L = 0, R = 1e9 + 10, mid, ans = -1;
    for (j = 0; j < 100; ++j) {
      mid = (L + R) / 2;
      bool ok = false;
      double Max = -1e50;
      for (i = 0; i < n; ++i) {
        p[i].ed = p[i].st + p[i].dir * mid;
        if (p[i].dir >= 0) {
          Max = max(Max, p[i].ed);
        } else {
          if (p[i].ed <= Max) {
            ok = true;
            break;
          }
        }
      }
      if (ok) {
        ans = mid;
        R = mid;
      } else {
        L = mid;
      }
    }
    printf("%.20f\n", ans);
  }
  return 0;
}
