#include <bits/stdc++.h>
using namespace std;
int x[101010], v[101010], t[101010];
int n, s;
int l[1010101], r[1010101];
bool check(double m) {
  memset(l, 0, sizeof(l));
  memset(r, 0, sizeof(r));
  for (int i = 1; i <= n; i++) {
    if (t[i] == 1) {
      if (1.0 * x[i] / v[i] < m)
        l[0]++;
      else {
        l[x[i]]++;
        l[max((long long)x[i],
              min(1000001LL,
                  (long long)floor((m * (v[i] + s) - x[i]) * (s - v[i]) / s +
                                   x[i])) +
                  1)]--;
      }
    } else {
      if (1.0 * (1000000 - x[i]) / v[i] < m)
        r[0]++;
      else {
        r[min(
            x[i] + 1LL,
            max(0LL, (long long)ceil(x[i] - (m * (v[i] + s) + x[i] - 1000000) *
                                                (s - v[i]) / s)))]++;
        r[x[i] + 1]--;
      }
    }
  }
  for (int i = 1; i <= 1000000; i++) {
    l[i] += l[i - 1];
    r[i] += r[i - 1];
    if (l[i] && r[i]) return true;
  }
  return false;
}
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d %d %d", &x[i], &v[i], &t[i]);
  double l1 = 1e-8, r1 = 1e6;
  while (r1 - l1 > 1e-7) {
    double mid = (l1 + r1) / 2;
    if (check(mid))
      r1 = mid;
    else
      l1 = mid;
  }
  printf("%.12lf\n", (l1 + r1) / 2);
  return 0;
}
