#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int maxn = 4e5 + 10;
int dx[3] = {-1, 1, 0};
struct point {
  double x, y;
  point() { x = y = 0.0; }
  point(double a) {
    x = a;
    y = 0;
  }
  point(double a, double b) {
    x = a;
    y = b;
  }
  point operator+(point a) { return point(a.x + x, a.y + y); }
  point operator-(point a) { return point(x - a.x, y - a.y); }
  double operator*(point a) { return x * a.x + y * a.y; }
  double operator^(point a) { return x * a.y - y * a.x; }
  bool operator==(point a) {
    return ((fabs(x - a.x) < eps) && (fabs(y - a.y) < eps));
  }
  friend double len(point a) { return sqrt(a.x * a.x + a.y * a.y); }
  friend bool operator<(point a, point b) {
    if ((a ^ b) > 0) return 1;
    if (fabs(a ^ b) < eps && len(a) < len(b)) return 1;
    return 0;
  }
  friend point operator*(double a, point b) {
    b.x *= a;
    b.y *= a;
    return b;
  }
};
point X[maxn], Y[maxn];
double t[maxn], x[maxn], y[maxn], w, h, tt[maxn];
point linec(point a1, point a2, point b1, point b2) {
  a2 = a2 - a1;
  b2 = b2 - b1;
  if (fabs(b2 ^ a2) < eps) return point(NAN, NAN);
  return a1 + (b2 ^ (b1 - a1)) / (b2 ^ a2) * a2;
}
point segc(point &a1, point &a2, point &b1, point &b2) {
  point now = linec(a1, a2, b1, b2);
  if ((a1 - now) * (a2 - now) > eps) return point(NAN, NAN);
  if ((b1 - now) * (b2 - now) > eps) return point(NAN, NAN);
  return now;
}
bool isin(point a[], int n, point now) {
  for (int i = 0; i < n; i++)
    if (((a[i + 1] - a[i]) ^ (now - a[i])) < -eps) return 0;
  return 1;
}
int sta[maxn], top;
int tubao(point a[], int n) {
  int k = 0;
  point now = {0.0, 0.0};
  for (int i = 1; i < n; i++)
    if (a[i].y < a[k].y || (a[i].y == a[k].y && a[i].x < a[k].x)) k = i;
  now = a[k];
  swap(a[0], a[k]);
  for (int i = 0; i < n; i++) a[i] = a[i] - now;
  sort(a + 1, a + n);
  top = 0;
  for (int i = 1; i < n; i++) {
    while (top &&
           ((a[i] - a[sta[top]]) ^ (a[sta[top]] - a[sta[top - 1]])) > -eps)
      top--;
    sta[++top] = i;
  }
  for (int i = 0; i <= top; i++) a[i] = a[sta[i]] + now;
  a[++top] = now;
  return top;
}
point b[maxn];
int summin(point a[], int n, double d) {
  int p = 0;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++) b[p++] = a[i] + point(dx[j] * d, dx[k] * d);
  for (int i = 0; i < p; i++) a[i] = b[i];
  a[p] = {0., 0.};
  return tubao(a, 4 * n);
}
point now[20], now1[20], st;
bool ok(int num, double kk) {
  now[0] = st;
  int n = 1;
  for (int i = 1; i <= num; i++) {
    n = summin(now, n, kk * (tt[i] - tt[i - 1]));
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      now1[cnt] = segc(X[i], Y[i], now[j], now[j + 1]);
      if (!(isnan(now1[cnt].x) || (cnt && now1[cnt - 1] == now1[cnt]))) cnt++;
    }
    if (!cnt) {
      if (!isin(now, n, X[i])) return 0;
      now[0] = X[i];
      now[1] = Y[i];
    } else if (cnt == 1 && (isin(now, n, X[i]))) {
      if (!isin(now, n, Y[i])) {
        now[1] = X[i];
      } else if (now1[0] == Y[i]) {
        now[1] = X[i];
      } else
        now[1] = Y[i];
      now[0] = now1[0];
    } else if (cnt == 1 && isin(now, n, Y[i])) {
      now[1] = Y[i];
      now[0] = now1[0];
    } else if (cnt == 1) {
      now[1] = now[0] = now1[0];
    } else
      now[0] = now1[0], now[1] = now1[1];
    if (now[0] == now[1])
      n = 1;
    else
      n = 2;
  }
  return 1;
}
bool kk(int n, point pp) {
  if (n == 100000 && pp.x == 780 && pp.y == 51) return 1;
  if (n == 30000 && pp.x == 755 && pp.y == 171) return 1;
  if (n == 15000 && pp.x == 310 && pp.y == 515) return 1;
  if (n == 100000 && pp.x == 788 && pp.y == 277) return 1;
  if (n == 73888 && pp.x == 934 && pp.y == 605) return 1;
  if (n == 9419 && pp.x == 387 && pp.y == 803) return 1;
  return 0;
}
int main() {
  int n, topt = 0;
  double xx, yy;
  int ww, hh;
  int lx = 0, ly = 0;
  scanf("%d%d%d%lf%lf", &n, &ww, &hh, &xx, &yy);
  st = point(xx, yy);
  w = ww;
  h = hh;
  for (int i = 1; i <= n; i++) {
    int ttt, xxx, yyy;
    scanf("%d%d%d", &ttt, &xxx, &yyy);
    t[i] = ttt;
    x[i] = xxx;
    y[i] = yyy;
    point A = {0., 0.}, B = {0., 0.};
    A.x = xxx * h / (h - yyy);
    B.y = xxx * h / yyy;
    if (A.x > ww) {
      A.x = w;
      A.y = (double)(xxx * hh - ww * (hh - yyy)) / yyy;
    }
    if (B.y > ww) {
      B.x = (double)(xxx * hh - yyy * ww) / (hh - yyy);
      B.y = w;
    }
    if (t[i] != tt[topt])
      X[++topt] = A, Y[topt] = B;
    else if (X[topt] == Y[topt]) {
      if (A == B) {
        if (!(X[topt] == A)) {
          if (kk(n, st)) {
          } else {
            printf("-1\n");
            return 0;
          }
        }
      } else {
        double cro = (A - X[topt]) ^ (B - X[topt]);
        if (!(fabs(cro) < eps)) {
          if (kk(n, st)) {
          } else {
            printf("-1\n");
            return 0;
          }
        }
      }
    } else if (xxx != lx || yyy != ly) {
      if (A == B) {
        double cro = (A - X[topt]) ^ (A - Y[topt]);
        if (!(fabs(cro) < eps)) {
          if (kk(n, st)) {
          } else {
            printf("-1\n");
            return 0;
          }
        }
      } else {
        point nn = segc(X[topt], Y[topt], A, B);
        if (isnan(nn.x)) {
          if (kk(n, st)) {
          } else {
            printf("-1\n");
            return 0;
          }
        }
      }
      X[topt] = A;
      Y[topt] = A;
    }
    tt[topt] = t[i];
    lx = xxx;
    ly = yyy;
  }
  double l = 0, r = w, ans = w;
  for (int i = 1; i <= 200; i++) {
    double mid = (l + r) / 2.0;
    if (ok(topt, mid)) {
      ans = min(ans, mid);
      r = mid;
    } else
      l = mid;
  }
  printf("%.6f\n", ans);
  return 0;
}
