#include <bits/stdc++.h>
inline int in() {
  int k = 0;
  char ch = getchar();
  while (ch < '-') ch = getchar();
  while (ch > '-') k = k * 10 + ch - '0', ch = getchar();
  return k;
}
const double eps = 1e-8, inf = 1e18;
const int N = 2e5 + 5;
double w, h, sx, sy, t[N], x[N], y[N];
int n;
inline int dcmp(const double &x) {
  return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1);
}
struct node {
  double x, y;
  node(double x = 0, double y = 0) : x(x), y(y) {}
  inline node operator+(const node &b) const { return node(x + b.x, y + b.y); }
  inline node operator-(const node &b) const { return node(x - b.x, y - b.y); }
  inline double operator*(const node &b) const { return x * b.y - y * b.x; }
  inline node operator*(const double &b) const { return node(x * b, y * b); }
  inline bool operator==(const node &b) const {
    return !dcmp(x - b.x) && !dcmp(y - b.y);
  }
  inline bool operator<(const node &b) const {
    return dcmp(x - b.x) == -1 || (dcmp(x - b.x) == 0 && dcmp(y - b.y) == -1);
  }
} tmp, s;
struct Line {
  node a, b;
  Line() {}
  Line(node a, node b) : a(a), b(b) {}
  inline void out() { printf("(%lf,%lf) (%lf,%lf)\n", a.x, a.y, b.x, b.y); }
} a[N];
template <typename T>
void cmin(T &x, T y) {
  if (y < x) x = y;
}
template <typename T>
void cmax(T &x, T y) {
  if (x < y) x = y;
}
node Line_jd(Line x, Line y) {
  double t1 = (y.a - x.a) * (y.b - x.a), t2 = (y.b - x.b) * (y.a - x.b);
  return (x.a * t2 + x.b * t1) * (1 / (t1 + t2));
}
inline bool px(Line a, Line b) { return dcmp((a.b - a.a) * (b.b - b.a)) == 0; }
bool in_line(const Line &x, const node &y) {
  return dcmp((y - x.a) * (y - x.b)) == 0;
}
inline void upd(Line &ans, Line a, node x, node y) {
  Line tmp = (x < y) ? (Line(x, y)) : (Line(y, x));
  if (px(tmp, a)) {
    if (in_line(a, x))
      cmin(ans.a, x), cmax(ans.b, x), cmin(ans.a, y), cmax(ans.b, y);
    return;
  }
  node pos = Line_jd(a, tmp);
  if (pos < tmp.a || tmp.b < pos) return;
  cmin(ans.a, pos);
  cmax(ans.b, pos);
}
inline void updatea(Line &ans, Line a, node x, node y) {
  Line tmp = (x < y) ? (Line(x, y)) : (Line(y, x));
  if (px(tmp, a)) return;
  node pos = Line_jd(a, tmp);
  if (pos < tmp.a || tmp.b < pos) return;
  cmax(ans.a, pos);
}
inline void updateb(Line &ans, Line a, node x, node y) {
  Line tmp = (x < y) ? (Line(x, y)) : (Line(y, x));
  if (px(tmp, a)) return;
  node pos = Line_jd(a, tmp);
  if (pos < tmp.a || tmp.b < pos) return;
  cmin(ans.b, pos);
}
inline bool check(double len) {
  Line now = Line(s, s);
  for (int i = 1; i <= n; ++i) {
    double del = (t[i] - t[i - 1]) * len;
    Line ans = Line(node(inf, inf), node(-inf, -inf));
    node x[4] = {now.a, now.a, now.a, now.a};
    node y[4] = {now.b, now.b, now.b, now.b};
    node dup = node(0, -del), ddn = node(0, del);
    node dle = node(-del, 0), dri = node(del, 0);
    x[0] = x[0] + dle + dup;
    x[1] = x[1] + dle + ddn;
    x[2] = x[2] + dri + ddn;
    x[3] = x[3] + dri + dup;
    y[0] = y[0] + dle + dup;
    y[1] = y[1] + dle + ddn;
    y[2] = y[2] + dri + ddn;
    y[3] = y[3] + dri + dup;
    for (int j = 0; j < 3; ++j) upd(ans, a[i], x[j], x[j + 1]);
    upd(ans, a[i], x[3], x[0]);
    for (int j = 0; j < 3; ++j) upd(ans, a[i], y[j], y[j + 1]);
    upd(ans, a[i], y[3], y[0]);
    for (int j = 0; j < 4; ++j) upd(ans, a[i], x[j], y[j]);
    updatea(ans, a[i], node(0, 0), node(0, w));
    if (a[i].a.y < a[i].b.y)
      updatea(ans, a[i], node(0, 0), node(w, 0));
    else
      updateb(ans, a[i], node(0, 0), node(w, 0));
    if (a[i].a.y > a[i].b.y)
      updatea(ans, a[i], node(w, w), node(0, w));
    else
      updateb(ans, a[i], node(w, w), node(0, w));
    updateb(ans, a[i], node(w, w), node(w, 0));
    if (ans.b < ans.a) return 0;
    now = ans;
  }
  return 1;
}
inline double Calc(double x, node a) {
  return a.x + (a.x - x) / a.y * (h - a.y);
}
int main() {
  n = in(), w = in(), h = in();
  s.x = in(), s.y = in();
  for (int i = 1; i <= n; ++i) {
    t[i] = in(), tmp.x = in(), tmp.y = in();
    a[i].a = node(0, Calc(0, tmp));
    a[i].b = node(w, Calc(w, tmp));
    if (a[i].b < a[i].a) std::swap(a[i].a, a[i].b);
  }
  double l = 0, r = w * 2;
  while (r - l > eps) {
    double mid = (l + r) / 2;
    check(mid) ? r = mid : l = mid;
  }
  double ans = (l + r) / 2;
  if (ans > w + eps)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}
