#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int x1, y1, x2, y2;
  cin >> n;
  cin >> x1 >> y1 >> x2 >> y2;
  int mice[n][4];
  for (int i = 0; i < n; i++) {
    cin >> mice[i][0] >> mice[i][1] >> mice[i][2] >> mice[i][3];
  }
  double result[n][2];
  bool impossible = false;
  for (int i = 0; i < n; i++) {
    int xdistance1 = x1 - mice[i][0];
    int xdistance2 = x2 - mice[i][0];
    int ydistance1 = y1 - mice[i][1];
    int ydistance2 = y2 - mice[i][1];
    double x_min_time = DBL_MAX;
    double x_max_time = DBL_MIN;
    double y_min_time = DBL_MAX;
    double y_max_time = DBL_MIN;
    double time;
    time = 1.0 * xdistance1 / mice[i][2];
    x_min_time = min(x_min_time, time);
    x_max_time = max(x_max_time, time);
    time = 1.0 * xdistance2 / mice[i][2];
    x_min_time = min(x_min_time, time);
    x_max_time = max(x_max_time, time);
    time = 1.0 * ydistance1 / mice[i][3];
    y_min_time = min(y_min_time, time);
    y_max_time = max(y_max_time, time);
    time = 1.0 * ydistance2 / mice[i][3];
    y_min_time = min(y_min_time, time);
    y_max_time = max(y_max_time, time);
    result[i][0] = max(x_min_time, y_min_time);
    result[i][1] = min(x_max_time, y_max_time);
  }
  if (impossible) {
    cout << -1;
  } else {
    double a = DBL_MIN;
    double b = DBL_MAX;
    for (int i = 0; i < n; i++) {
      a = max(result[i][0], a);
      b = min(result[i][1], b);
    }
    if (a >= b) {
      cout << -1;
    } else {
      cout << a;
    }
  }
}
