#include <bits/stdc++.h>
using namespace std;
int n;
int X[500000], V[500000];
bool les(double a, double b) { return ((b - a) > (1E-11)); }
bool mor(double a, double b) { return ((a - b) > (1E-11)); }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d%d", &X[i], &V[i]);
  int i = 0;
  while (i < n && V[i] < 0) i++;
  bool ok = true;
  for (int j = i; j < n; j++)
    if (V[j] < 0) ok = false;
  if (ok) {
    cout << -1 << endl;
    return 0;
  }
  double l = 0, r = 10000000000;
  for (int t = 0; t < 70; t++) {
    double e = (l + r) / 2;
    ok = false;
    double maxRight = -100000000000;
    for (int i = 0; i < n; i++)
      if (V[i] > 0) {
        if (mor(X[i] + V[i] * e, maxRight)) maxRight = X[i] + V[i] * e;
      } else {
        if (!mor(X[i] + V[i] * e, maxRight)) ok = true;
      }
    if (ok)
      r = e;
    else
      l = e;
  }
  printf("%0.11f\n", l);
  return 0;
}
