Problem: Recently the construction of Berland collider has been completed. Collider can be represented as a long narrow tunnel that contains n particles. We associate with collider 1-dimensional coordinate system, going from left to right. For each particle we know its coordinate and velocity at the moment of start of the collider. The velocities of the particles don't change after the launch of the collider. Berland scientists think that the big bang will happen at the first collision of particles, whose velocities differs in directions. Help them to determine how much time elapses after the launch of the collider before the big bang happens.

Input

The first line contains single integer n (1 ≤ n ≤ 5·105) — amount of particles in the collider. Next n lines contain description of particles. Each particle is described by two integers xi, vi ( - 109 ≤ xi, vi ≤ 109, vi ≠ 0) — coordinate and velocity respectively. All the coordinates are distinct. The particles are listed in order of increasing of coordinates. All the coordinates are in meters, and all the velocities — in meters per second. The negative velocity means that after the start of collider the particle will move to the left, and the positive — that the particle will move to the right.

Output

If there will be no big bang, output -1. Otherwise output one number — how much time in seconds elapses after the launch of the collider before the big bang happens. Your answer must have a relative or absolute error less than 10 - 9.

Examples

Input

3
-5 9
0 1
5 -1


Output

1.00000000000000000000


Input

6
1 3
2 3
3 3
4 -3
5 -1
6 -100


Output

0.02912621359223301065

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int limite = 1000000;
int num;
double posicion[limite];
double velocidad[limite];
double entra[limite];
void calcula(vector<pair<double, double> > &lista, vector<double> &p,
             vector<double> &v, vector<double> &e) {
  posicion[0] = lista[0].first;
  velocidad[0] = lista[0].second;
  num = 1;
  for (int i = 1; i < int(lista.size()); i++) {
    double pos = lista[i].first;
    double vel = lista[i].second;
    if (vel < velocidad[num - 1]) {
      posicion[num] = pos;
      velocidad[num] = vel;
      entra[num] = (pos - posicion[num - 1]) / (velocidad[num - 1] - vel);
      while (num > 1 and entra[num] <= entra[num - 1]) {
        posicion[num - 1] = posicion[num];
        velocidad[num - 1] = velocidad[num];
        entra[num - 1] = entra[num];
        num--;
        entra[num] = (pos - posicion[num - 1]) / (velocidad[num - 1] - vel);
      }
      num++;
    }
  }
  p = v = e = vector<double>(num);
  for (int i = 0; i < num; i++) {
    p[i] = posicion[i];
    v[i] = velocidad[i];
    e[i] = entra[i];
  }
}
bool hayminimototal = false;
double minimototal;
void seccion(vector<pair<double, double> > &moveright,
             vector<pair<double, double> > &moveleft) {
  if (int(moveright.size()) == 0 or int(moveleft.size()) == 0) return;
  vector<double> pl, vl, el;
  calcula(moveleft, pl, vl, el);
  for (int i = 0; i < int(moveright.size()); i++) {
    moveright[i].first *= -1;
    moveright[i].second *= -1;
  }
  reverse(moveright.begin(), moveright.end());
  vector<double> pr, vr, er;
  calcula(moveright, pr, vr, er);
  for (int i = 0; i < int(pr.size()); i++) {
    pr[i] *= -1;
    vr[i] *= -1;
  }
  int il = 0;
  int ir = 0;
  for (;;) {
    double t = (pl[il] - pr[ir]) / (vr[ir] - vl[il]);
    if (ir < int(pr.size()) - 1 and er[ir + 1] < t) {
      if (il < int(pl.size()) - 1 and el[il + 1] < t) {
        if (er[ir + 1] < el[il + 1]) {
          ir++;
        } else {
          il++;
        }
      } else {
        ir++;
      }
    } else if (il < int(pl.size()) - 1 and el[il + 1] < t) {
      il++;
    } else {
      break;
    }
  }
  double t = (pl[il] - pr[ir]) / (vr[ir] - vl[il]);
  if (not hayminimototal or minimototal > t) {
    hayminimototal = true;
    minimototal = t;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(15);
  vector<vector<pair<double, double> > > move(2);
  int j = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, v;
    cin >> x >> v;
    if (j == 0) {
      if (v > 0) {
        move[0].push_back(pair<double, double>(x, v));
      } else {
        j = 1;
        move[1].push_back(pair<double, double>(x, v));
        if (i == n - 1) seccion(move[0], move[1]);
      }
    } else if (j == 1) {
      if (v > 0) {
        seccion(move[0], move[1]);
        move = vector<vector<pair<double, double> > >(2);
        j = 0;
        move[0].push_back(pair<double, double>(x, v));
      } else {
        move[1].push_back(pair<double, double>(x, v));
        if (i == n - 1) seccion(move[0], move[1]);
      }
    }
  }
  if (hayminimototal)
    cout << minimototal << endl;
  else
    cout << -1 << endl;
}