#include <bits/stdc++.h>
using namespace std;
struct Men {
  int pos;
  int go;
  int speed;
};
Men men[100005];
int n, v;
double middle, lft, rht = 1e6;
int l[1000005], r[1000005];
long long dist;
inline bool check(double x) {
  memset(l, 0, sizeof(l));
  memset(r, 0, sizeof(r));
  for (register int i = 1; i <= n; i++) {
    if (men[i].go == 1) {
      if (men[i].pos < x * men[i].speed + 1e-10) {
        l[0]++;
        continue;
      }
      dist =
          floor((v - men[i].speed) * (x * (men[i].speed + v) - men[i].pos) / v +
                men[i].pos);
      if (dist >= men[i].pos) {
        dist = (dist < 1e6 ? dist : 1e6);
        l[men[i].pos]++;
        l[dist + 1]--;
      }
    }
    if (men[i].go == 2) {
      if (x * men[i].speed + men[i].pos + 1e-10 > 1e6) {
        r[0]++;
        continue;
      }
      dist = ceil(men[i].pos - (v - men[i].speed) *
                                   (x * (men[i].speed + v) - 1e6 + men[i].pos) /
                                   v);
      if (dist <= men[i].pos) {
        dist = (dist > 0 ? dist : 0);
        r[dist]++;
        r[men[i].pos + 1]--;
      }
    }
  }
  for (register int i = 1; i <= 1e6; i++) {
    l[i] += l[i - 1];
    r[i] += r[i - 1];
    if (l[i] && r[i]) {
      return true;
    }
  }
  return l[0] && r[0];
}
int main() {
  scanf("%d%d", &n, &v);
  for (register int i = 1; i <= n; i++) {
    scanf("%d%d%d", &men[i].pos, &men[i].speed, &men[i].go);
  }
  while (rht - lft > 1e-10) {
    middle = (lft + rht) / 2.0;
    switch (check(middle)) {
      case true:
        rht = middle;
        break;
      case false:
        lft = middle;
        break;
    }
  }
  printf("%0.10lf\n", lft);
  return 0;
}
