#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int v[N], x[N], dir[N];
int lef[N * 10], ri[10 * N];
int n, s;
bool check(double t) {
  int rmin, rmax;
  double mt;
  memset(lef, 0, sizeof(lef));
  memset(ri, 0, sizeof(ri));
  for (int i = 0; i < n; i++) {
    rmin = rmax = x[i];
    if (dir[i] == 1) {
      mt = (t * (s + v[i]) - x[i]) / (1.0 * s);
      rmax = min((long long)(mt * (s - v[i])) + x[i], 1000000LL);
      if (mt >= t) {
        rmin = 0;
        rmax = 1000000;
      }
      if (mt >= 0) {
        lef[rmin]++;
        lef[rmax + 1]--;
      }
    } else {
      mt = (t * (s + v[i]) + x[i] - 1000000) / (1.0 * s);
      rmin = max(0LL, x[i] - (long long)(mt * (s - v[i])));
      if (mt >= t) {
        rmax = 1000000;
        rmin = 0;
      }
      if (mt >= 0) {
        ri[rmin]++;
        ri[rmax + 1]--;
      }
    }
  }
  for (int i = 0; i <= 1000000; i++) {
    if (i > 0) {
      lef[i] += lef[i - 1];
      ri[i] += ri[i - 1];
    }
    if (lef[i] > 0 && ri[i] > 0) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d", &x[i], &v[i], &dir[i]);
  }
  double l = 0, r = 1000000;
  while (r - l > 1e-9) {
    double mid = (r + l) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  cout << fixed << setprecision(12);
  cout << r;
}
