#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 1000000;
const double eps = 1e-9;
int n, s, na, nb, c[M + 10];
struct A {
  int x, v;
  double y;
  A() {}
  A(int _x, int _v) {
    x = _x;
    v = _v;
    y = (double)(s + v) * (s - v);
  }
} a[N], b[N];
int chk(double T) {
  int i;
  memset(c, 0, sizeof(c));
  for (i = 1; i <= na; ++i) {
    if (T * a[i].v > a[i].x) {
      c[0]++;
      break;
    }
    if (T * (a[i].v + s) < a[i].x) continue;
    int t =
        (int)min((double)M, floor((T * a[i].y + (double)a[i].x * a[i].v) / s));
    c[a[i].x]++;
    c[t + 1]--;
  }
  for (i = 1; i <= M; ++i) c[i] += c[i - 1];
  for (i = 1; i <= M; ++i) c[i] = (c[i] > 0) + c[i - 1];
  for (i = 1; i <= nb; ++i) {
    if (T * b[i].v > M - b[i].x - eps) return c[M];
    if (T * (b[i].v + s) < M - b[i].x + eps) continue;
    int t = (int)max(
        (double)0, ceil(-((double)b[i].v * (M - b[i].x) + T * b[i].y) / s + M));
    if (!t && c[b[i].x]) return 1;
    if (t && c[b[i].x] - c[t - 1]) return 1;
  }
  return 0;
}
int main() {
  int i, j, x, y, z;
  scanf("%d%d", &n, &s);
  for (i = 1; i <= n; ++i) {
    scanf("%d%d%d", &x, &y, &z);
    --z;
    if (!z)
      a[++na] = A(x, y);
    else
      b[++nb] = A(x, y);
  }
  double l = 0, r = 1e6, mid;
  for (; l + eps < r;) {
    if (chk(mid = (l + r) / 2))
      r = mid;
    else
      l = mid;
  }
  printf("%.8f\n", r);
  return 0;
}
