#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 20;
int N;
pair<int, int> ar[maxn];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d %d", &ar[i].first, &ar[i].second);
  sort(ar + 1, ar + N + 1);
  int flag = 0;
  for (int i = 1, is = 0; i <= N; i++)
    if (ar[i].second > 0)
      is = 1;
    else
      flag = is;
  if (!flag) {
    printf("-1\n");
    return 0;
  }
  double l = 0, r = 2e9;
  for (int i = 1; i <= 300; i++) {
    double x = (l + r) / 2;
    bool is = 0;
    double mx = -2e18;
    for (int j = 1; j <= N; j++) {
      double pos = ar[j].first + ar[j].second * x;
      if (ar[j].second > 0)
        mx = max(mx, pos);
      else if (mx >= pos) {
        is = 1;
        break;
      }
    }
    if (is)
      r = x;
    else
      l = x;
  }
  printf("%.10lf", l);
  return 0;
}
