#include <bits/stdc++.h>
using namespace std;
int n, x, y, f, a, b, cnt;
double l, r, mid, z, xx, s;
vector<pair<int, int> > v;
int main() {
  scanf("%d", &n);
  x = -1, y = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    v.push_back(make_pair(a, b));
    if (b > 0) {
      if (f == 0) x = i, f = 1;
    } else if (b != 0)
      y = i;
  }
  if (x == -1 || y == -1 || x > y)
    printf("%.15f\n", (double)-1);
  else {
    cnt = 70, l = 1e9;
    while (cnt--) {
      mid = (l + r) / 2, a = 0;
      z = v[x].first + (mid * v[x].second);
      for (int i = x + 1; i < n; i++) {
        xx = v[i].first, s = v[i].second;
        if (s > 0)
          z = max(z, xx + (mid * s));
        else if (xx + (mid * s) <= z) {
          a = 1;
          break;
        }
      }
      if (a == 1)
        l = mid;
      else
        r = mid;
    }
    printf("%.15f\n", mid);
  }
  return 0;
}
