#include <bits/stdc++.h>
using namespace std;
int const nmax = 100000;
int const domain = 1000000;
struct Person {
  int x;
  int v;
  bool operator<(Person other) const { return x < other.x; }
};
bitset<domain> okl, okr;
Person pl[1 + nmax], pr[1 + nmax];
int nl, nr, vray;
double gettime(Person p, int distray) {
  double s = vray;
  int distp = p.x;
  int vp = p.v;
  double timep = 1.0L * distp / vp;
  double timehit = 1.0L * (distray - distp) / (s - vp);
  if (timep <= timehit)
    return timep;
  else {
    double disthit = distp - timehit * vp;
    return timehit + (disthit / (vp + s));
  }
}
void solve(double target, Person *p, int np, bitset<domain> *ok) {
  for (int i = 1; i <= np; i++) {
    if (p[i].x <= p[i].v * target) {
      for (int j = 1; j < domain; j++) (*ok)[j] = 1;
      return;
    }
  }
  int i = 1, j = 1;
  while (j < domain) {
    if (np < i || j < p[i].x) {
      (*ok)[j] = false;
      j++;
    } else if (gettime(p[i], j) <= target) {
      (*ok)[j] = true;
      j++;
    } else
      i++;
  }
}
int main() {
  int n;
  scanf("%d %d", &n, &vray);
  for (int i = 1; i <= n; i++) {
    int coord, v, dir;
    scanf("%d %d %d", &coord, &v, &dir);
    if (dir == 1) {
      nl++;
      pl[nl] = {coord, v};
    } else {
      nr++;
      pr[nr] = {domain - coord, v};
    }
  }
  sort(pl + 1, pl + nl + 1);
  sort(pr + 1, pr + nr + 1);
  double lim1 = 0, lim2 = domain, mid;
  double precizie = 0.0000001 / 10;
  while (lim1 + precizie < lim2) {
    mid = (lim2 + lim1) / 2;
    solve(mid, pl, nl, &okl);
    solve(mid, pr, nr, &okr);
    int flag = 0, i = 1;
    while (flag == 0 && i < domain) {
      if (okl[i] == 1 && okr[domain - i] == 1) {
        flag = 1;
      }
      i++;
    }
    if (flag == 1)
      lim2 = mid;
    else
      lim1 = mid;
  }
  printf("%.12lf", mid);
  return 0;
}
