#include <bits/stdc++.h>
using namespace std;
const int N = 5 * 100005;
int m, n;
vector<pair<int, int> > A;
vector<pair<int, int> > B;
set<int> Hash;
int main() {
  scanf("%d", &n);
  Hash.clear();
  A.clear();
  B.clear();
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (y > 0) A.push_back(make_pair(x, y));
    if (y < 0) B.push_back(make_pair(x, y));
  }
  m = A.size();
  n = B.size();
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  double l = 0, r = 1e10, mid;
  for (int k = 1; k <= 100; k++) {
    mid = (l + r) / 2;
    int j = 0;
    bool check = false;
    double Max = -1e20;
    for (int i = 0; i < n; i++) {
      while (j < m && A[j].first < B[i].first) {
        Max = max(Max, A[j].first + A[j].second * mid);
        j++;
      }
      if (Max >= B[i].first + B[i].second * mid) {
        check = true;
        break;
      }
    }
    if (check)
      r = mid;
    else
      l = mid;
  }
  if (l > 9e9)
    puts("-1");
  else
    printf("%.12lf\n", l);
}
