#include <bits/stdc++.h>
using namespace std;
const int SZ = 1 << 19;
const double inf = 1e100;
pair<int, int> p[SZ];
int n;
int main() {
  scanf("%d", &n);
  int ind1 = n + 1;
  int ind2 = -1;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &p[i].first, &p[i].second);
    if (p[i].second == 0) {
      --i, --n;
      continue;
    }
    if (p[i].second > 0) ind1 = min(ind1, i);
    if (p[i].second < 0) ind2 = max(ind2, i);
  }
  if (ind1 > ind2) {
    puts("-1");
    return 0;
  }
  double Min = 0;
  double Max = 1000000000;
  for (int it = 0; it < 120; ++it) {
    double Mid = (Min + Max) / 2;
    double pos = -1e100;
    bool was = 0;
    bool can = 0;
    for (int i = 0; i < n; ++i)
      if (p[i].second > 0)
        pos = max(pos, p[i].first + p[i].second * Mid), was = 1;
      else if (was && pos + 1e-12 > p[i].first + p[i].second * Mid) {
        can = 1;
        break;
      }
    if (can)
      Max = Mid;
    else
      Min = Mid;
  }
  printf("%.15lf\n", (Min + Max) / 2);
  return 0;
}
