#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int N;
pair<int, int> P[500001];
int check(double t) {
  double nextEnd = -1e9;
  int f = 0;
  for (int i = 0; i < N; ++i) {
    double pos = P[i].first + P[i].second * t;
    if (P[i].second > 0) {
      f = 1;
      nextEnd = max(nextEnd, pos);
    } else if (f && pos <= nextEnd)
      return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(12);
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> P[i].first >> P[i].second;
  }
  double l = 0, r = 2e9;
  int it = 0;
  int ans = 0;
  while (r - l >= 1e-9) {
    it++;
    double t = l + (r - l) / 2;
    if (check(t)) {
      r = t;
      ans = 1;
    } else
      l = t;
  }
  if (ans)
    cout << l + (r - l) / 2 << endl;
  else
    cout << -1 << endl;
  return 0;
}
