#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return (b == 0) ? a : GCD(b, a % b); }
long long LCM(long long a, long long b) {
  long long temp = GCD(a, b);
  return temp ? (a / temp * b) : 0;
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
long long oo = 1e18;
long long const M = 1e9 + 7, N = 2e5 + 7;
long long n, sum, m;
vector<pair<int, int> > v;
bool can(double x) {
  double c = -1e99;
  for (int i = 0; i < n; i++) {
    if (v[i].second > 0)
      c = max(c, v[i].first + v[i].second * x);
    else if (v[i].first + v[i].second * x <= c)
      return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  int x, y;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v[i] = make_pair(x, y);
  }
  double l = 0, r = 1e12, mid;
  for (int i = 0; i < 100; i++) {
    mid = (l + r) * 0.5;
    if (can(mid)) {
      r = mid;
    } else
      l = mid;
  }
  if (r < 1e10)
    printf("%.12f\n", r);
  else
    printf("-1\n");
  return 0;
}
