#include <bits/stdc++.h>
using namespace std;
struct line {
  double a, b, c;
};
pair<double, double> toVec(pair<double, double> a, pair<double, double> b) {
  return pair<double, double>(b.first - a.first, b.second - a.second);
}
pair<double, double> scale(pair<double, double> a, double s) {
  return pair<double, double>(a.first * s, a.second * s);
}
pair<double, double> translate(pair<double, double> p, pair<double, double> t) {
  return pair<double, double>(p.first + t.first, p.second + t.second);
}
double dot(pair<double, double> a, pair<double, double> b) {
  return a.first * b.first + a.second * b.second;
}
double norm_sq(pair<double, double> a) {
  return a.first * a.first + a.second * a.second;
}
double dist(pair<double, double> a, pair<double, double> b) {
  return hypot(a.first - b.first, a.second - b.second);
}
double distToLine(pair<double, double> p, pair<double, double> a,
                  pair<double, double> b, pair<double, double> &c) {
  pair<double, double> ap = toVec(a, p), ab = toVec(a, b);
  double u = dot(ap, ab) / norm_sq(ab);
  c = translate(a, scale(ab, u));
  return dist(p, c);
}
double distToLineSegment(pair<double, double> p, pair<double, double> a,
                         pair<double, double> b, pair<double, double> &c) {
  pair<double, double> ap = toVec(a, p), ab = toVec(a, b);
  double u = dot(ap, ab) / norm_sq(ab);
  if (u < 0.0) {
    c = pair<double, double>(a.first, a.second);
    return dist(p, a);
  }
  if (u > 1.0) {
    c = pair<double, double>(b.first, b.second);
    return dist(p, b);
  }
  return distToLine(p, a, b, c);
}
void ptl(pair<double, double> p1, pair<double, double> p2, line &l1) {
  if (fabs(p1.first - p2.first) < 0.000000000001) {
    l1.a = 1.0;
    l1.b = 0.0;
    l1.c = -p1.first;
  } else {
    l1.a = -(double)(p1.second - p2.second) / (p1.first - p2.first);
    l1.b = 1.0;
    l1.c = -(double)(l1.a * p1.first) - p1.second;
  }
}
bool paralell(line l1, line l2) {
  return fabs(l1.a - l2.a) < 0.000000000001 &&
         fabs(l1.b - l2.b) < 0.000000000001;
}
bool same(line l1, line l2) {
  return (paralell(l1, l2) && fabs(l1.c - l2.c) < 0.000000000001);
}
void intersect(line l1, line l2, pair<double, double> &ans) {
  if (paralell(l1, l2)) {
    ans = pair<double, double>(-1e9, -1e9);
    return;
  }
  ans.first = (l2.b * l1.c - l1.b * l2.c) / (l2.a * l1.b - l1.a * l2.b);
  if (fabs(l1.b) > 0.000000000001)
    ans.second = -(l1.a * ans.first + l1.c);
  else
    ans.second = -(l2.a * ans.first + l2.c);
}
bool inside(pair<double, double> a, pair<double, double> b,
            pair<double, double> p) {
  if (a > b) swap(a, b);
  double minx = min(a.first, b.first), maxx = max(a.first, b.first),
         miny = min(a.second, b.second), maxy = max(a.second, b.second);
  bool ans = (p.first >= minx && p.first <= maxx && p.second >= miny &&
              p.second <= maxy);
  return ans;
}
bool inside_square(pair<double, double> a, pair<double, double> b,
                   pair<double, double> p) {
  double minx = min(a.first, b.first), maxx = max(a.first, b.first),
         miny = min(a.second, b.second), maxy = max(a.second, b.second);
  if (p.first > minx && p.first < maxx && p.second > miny && p.second < maxy)
    return true;
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  int x1, y1, x2, y2;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  if (x1 > x2) swap(x1, x2);
  if (y1 > y2) swap(y1, y2);
  if (x1 == x2 || y1 == y2) {
    printf("-1\n");
    return 0;
  }
  vector<pair<double, double> > events;
  for (int i = int(0); i < (int)n; ++i) {
    int a, b, dx, dy;
    scanf("%d %d %d %d", &a, &b, &dx, &dy);
    double sx, fx, sy, fy;
    if (a > x1 && a < x2) {
      sx = 0.0;
      if (dx < 0)
        fx = abs(a - x1) / (double)abs(dx);
      else if (dx > 0)
        fx = abs(a - x2) / (double)abs(dx);
      else
        fx = 1e15;
    } else {
      if (dx) {
        if (a <= x1) {
          if (dx < 0) {
            printf("-1\n");
            return 0;
          }
          sx = abs(a - x1) / (double)abs(dx) + 0.000000000001;
          fx = abs(a - x2) / (double)abs(dx);
        } else if (a >= x2) {
          if (dx > 0) {
            printf("-1\n");
            return 0;
          }
          sx = abs(a - x2) / (double)abs(dx) + 0.000000000001;
          fx = abs(a - x1) / (double)abs(dx);
        }
      } else {
        printf("-1\n");
        return 0;
      }
    }
    if (b > y1 && b < y2) {
      sy = 0.0;
      if (dy < 0)
        fy = abs(b - y1) / (double)abs(dy);
      else if (dy > 0)
        fy = abs(b - y2) / (double)abs(dy);
      else
        fy = 1e15;
    } else {
      if (dy) {
        if (b <= y1) {
          if (dy < 0) {
            printf("-1\n");
            return 0;
          }
          sy = abs(b - y1) / (double)abs(dy) + 0.000000000001;
          fy = abs(b - y2) / (double)abs(dy);
        } else if (b >= y2) {
          if (dy > 0) {
            printf("-1\n");
            return 0;
          }
          sy = abs(b - y2) / (double)abs(dy) + 0.000000000001;
          fy = abs(b - y1) / (double)abs(dy);
        }
      } else {
        printf("-1\n");
        return 0;
      }
    }
    events.push_back(pair<double, double>(max(sx, sy), 0));
    events.push_back(pair<double, double>(min(fx, fy), 1));
  }
  sort(events.begin(), events.end());
  int cnt = 0;
  double ans = -1;
  double tmp = 0;
  for (int i = int(0); i < (int)events.size(); ++i) {
    if (cnt == n) {
      ans = tmp;
      break;
    }
    if (events[i].second == 0) {
      tmp = max(tmp, events[i].first);
      cnt++;
    } else {
      cnt--;
    }
  }
  if (cnt == n) {
    ans = tmp;
  }
  printf("%.12lf\n", ans);
  return 0;
}
