#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
int main() {
  int n;
  scanf("%d", &n);
  vector<double> x(n), v(n);
  for (int i = 0; i < n; ++i) scanf("%lf %lf", &x[i], &v[i]);
  bool flag = false;
  for (int i = 0; i < n; ++i)
    if (v[i] > 0) {
      for (int j = i + 1; j < n; ++j)
        if (v[j] < 0) {
          flag = true;
          break;
        }
      break;
    }
  if (!flag) {
    printf("-1\n");
    return 0;
  }
  double l = 0, r = 1e9;
  while (fabs(r - l) > EPS) {
    double mid = (l + r) / 2;
    double left = 0, right = -1e20;
    bool flag = false;
    for (int i = 0; i < n; ++i)
      if (v[i] > 0)
        right = max(right, x[i] + v[i] * mid);
      else {
        left = x[i] + v[i] * mid;
        if (right > left) {
          r = mid;
          flag = true;
          break;
        }
      }
    if (!flag) l = mid;
  }
  printf("%.9lf\n", r);
  return 0;
}
