#include <bits/stdc++.h>
using namespace std;
int **a;
int n;
bool check(double t);
int main() {
  cin >> n;
  a = new int *[n];
  for (int i = 0; i < n; i++) a[i] = new int[2];
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i][0], &a[i][1]);
  }
  int total = 0;
  for (total = 0; total < n; total++) {
    if (a[total][1] > 0) {
      break;
    }
  }
  bool flag = true;
  for (int i = total; i < n; i++) {
    if (a[i][1] < 0) {
      flag = false;
      break;
    }
  }
  if (flag == true || total == n) {
    cout << "-1" << endl;
    return 0;
  }
  double left = 0;
  double right = 1e9;
  double mid;
  int i = 80;
  while (i > 0) {
    i--;
    mid = (left + right) / 2;
    if (check(mid) == true) {
      right = mid;
    } else {
      left = mid;
    }
  }
  cout << fixed;
  cout << setprecision(15) << right << endl;
}
bool check(double t) {
  double max = -1e10;
  double temp;
  for (int i = 0; i < n; i++) {
    if (a[i][1] > 0) {
      temp = a[i][0] + a[i][1] * t;
      if (temp > max) max = temp;
    } else {
      if (a[i][0] + a[i][1] * t <= max) return true;
    }
  }
  return false;
}
