#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, s;
int x[N], v[N], t[N];
int lf[N], ri[N];
bool check(double k) {
  memset(lf, 0, sizeof(lf));
  memset(ri, 0, sizeof(ri));
  for (int i = 0; i < n; i++) {
    if (t[i] == 1) {
      if (k > 1.0 * x[i] / v[i])
        lf[0]++;
      else
        lf[x[i]]++,
            lf[max(1LL * x[i],
                   min(1000001LL,
                       (long long)floor(
                           (k * (v[i] + s) - x[i]) * (s - v[i]) / s + x[i])) +
                       1)]--;
    } else {
      if (k > 1.0 * (1000000 - x[i]) / v[i])
        ri[0]++;
      else
        ri[min(
            x[i] + 1LL,
            max(0LL, (long long)ceil(x[i] - (k * (v[i] + s) + x[i] - 1000000) *
                                                (s - v[i]) / s)))]++,
            ri[x[i] + 1]--;
    }
  }
  for (int i = 1; i < 1e6 + 1; i++) {
    lf[i] += lf[i - 1];
    ri[i] += ri[i - 1];
  }
  for (int i = 1; i < 1e6 + 1; i++)
    if (lf[i] && ri[i]) return 1;
  return 0;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) scanf("%d%d%d", &x[i], &v[i], &t[i]);
  double l = 0.0, r = 1e6;
  for (int i = 0; i < 50; i++) {
    double m = (l + r) * 0.5;
    if (check(m))
      r = m;
    else
      l = m;
  }
  printf("%.10f\n", r);
  return 0;
}
