#include <bits/stdc++.h>
using namespace std;
int n, lx, ly, hx, hy;
double l, h;
int main() {
  scanf("%d %d %d %d %d", &n, &lx, &ly, &hx, &hy);
  h = 1e9;
  while (n--) {
    int x, y, dx, dy;
    scanf("%d %d %d %d", &x, &y, &dx, &dy);
    int left = lx - x, right = hx - x;
    if (!dx) {
      if (left >= 0 || right <= 0) {
        puts("-1");
        return 0;
      }
    } else if (dx < 0) {
      dx = -dx;
      swap(left, right);
      left = -left;
      right = -right;
    }
    if (max(0, left) >= right) {
      puts("-1");
      return 0;
    }
    double lt = max(0.0, (double)left / dx), rt = (double)right / dx;
    l = max(l, lt);
    h = min(h, rt);
    left = ly - y, right = hy - y;
    if (!dy) {
      if (left >= 0 || right <= 0) {
        puts("-1");
        return 0;
      }
    } else if (dy < 0) {
      dy = -dy;
      swap(left, right);
      left = -left;
      right = -right;
    }
    if (max(0, left) >= right) {
      puts("-1");
      return 0;
    }
    lt = max(0.0, (double)left / dy), rt = (double)right / dy;
    l = max(l, lt);
    h = min(h, rt);
    if (l + 1e-12 > h) {
      puts("-1");
      return 0;
    }
  }
  printf("%.6lf\n", l);
}
