#include <bits/stdc++.h>
using namespace std;
const int L = (int)1e6, N = (int)1e6;
long long n, s, x[N], v[N], t[N];
bool check(double now) {
  long long l1 = L + 1, r1 = 0, l2 = L + 1, r2 = 0;
  for (int i = 1; i <= n; i++) {
    if (t[i] & 1) {
      if (v[i] * now >= x[i])
        l1 = 0, r1 = L;
      else if ((v[i] + s) * now >= x[i])
        l1 = min(l1, x[i]),
        r1 = max(r1, x[i] + (long long)(now * s + v[i] * now - x[i]) *
                                (s - v[i]) / s);
    } else {
      if (v[i] * now >= L - x[i])
        l2 = 0, r2 = L;
      else if ((v[i] + s) * now >= L - x[i])
        r2 = max(r2, x[i]),
        l2 = min(l2, x[i] - (long long)(now * s + v[i] * now - L + x[i]) *
                                (s - v[i]) / s);
    }
  }
  return !(l1 > r2 || l2 > r1);
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) scanf("%lld%lld%lld", &x[i], &v[i], &t[i]);
  double l = 0, r = (long long)L + 0.0;
  for (int i = 1; i <= 50; i++) {
    double mid = (l + r) / 2.0;
    check(mid) ? r = mid : l = mid;
  }
  printf("%.10f\n", l);
}
