#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, v, w;
} a[1000010];
int n, s, suml[1000010], sumr[1000010];
double l = 0, r = 1000010;
bool judge(double t) {
  memset(suml, 0, sizeof(suml)), memset(sumr, 0, sizeof(sumr));
  for (int i = 1; i <= n; i++)
    if (a[i].w == 1) {
      double d = a[i].x;
      if (d < t * (1.0 * a[i].v) + (1e-8)) {
        suml[0]++;
        continue;
      }
      long long dis = floor((t * (1.0 * (a[i].v + s)) - d) *
                                (1.0 * (s - a[i].v)) / (1.0 * s) +
                            1.0 * a[i].x);
      if (dis >= a[i].x)
        dis = min(dis, 1000000ll), suml[a[i].x]++, suml[dis + 1]--;
    } else {
      double d = 1000000 - a[i].x;
      if (d < t * (1.0 * a[i].v) + (1e-8)) {
        sumr[0]++;
        continue;
      }
      long long dis = ceil(1.0 * a[i].x - (t * (1.0 * (a[i].v + s)) - d) *
                                              (1.0 * (s - a[i].v)) / (1.0 * s));
      if (dis <= a[i].x) dis = max(dis, 0ll), sumr[dis]++, sumr[a[i].x + 1]--;
    }
  for (int i = 1; i <= 1000000; i++) {
    suml[i] += suml[i - 1], sumr[i] += sumr[i - 1];
    if (suml[i] && sumr[i]) return 1;
  }
  return suml[0] && sumr[0];
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d%d%d", &a[i].x, &a[i].v, &a[i].w);
  while (r - l > (1e-8)) {
    double mid = (l + r) / 2;
    if (judge(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.6f\n", l);
}
