#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const double g = 10.0, eps = 1e-7;
const int N = 100000 + 10, maxn = 1000000 + 10, inf = 0x3f3f3f;
struct person {
  int lo, v, dir;
} a[N];
int n, s;
bool check(double limit) {
  bool left, right;
  left = right = false;
  long long left_l = (long long)1e6, left_r = 0, right_l = (long long)1e6,
            right_r = 0;
  for (int i = 0; i < n; i++) {
    if (a[i].dir == 1) {
      double pos = (double)a[i].lo - (a[i].v + s) * limit;
      if (pos > 0.0) continue;
      left = true;
      pos = (double)a[i].lo - a[i].v * limit;
      if (pos <= 0.0) {
        left_l = 0;
        left_r = (int)1e6;
        continue;
      }
      double min_time = (double)(a[i].lo - limit * a[i].v) / s;
      long long lo = a[i].lo + floor((limit - min_time) * (s - a[i].v));
      left_l = min(left_l, (long long)(a[i].lo));
      left_r = max(left_r, lo);
    } else {
      double pos = (double)a[i].lo + (a[i].v + s) * limit;
      if (pos < 1e6) continue;
      right = true;
      pos = (double)a[i].lo + a[i].v * limit;
      if (pos >= 1e6) {
        right_l = 0;
        right_r = 1e6;
        continue;
      }
      double min_time = (double)(1e6 - a[i].lo - a[i].v * limit) / s;
      long long lo = a[i].lo - floor((limit - min_time) * (s - a[i].v));
      right_l = min(right_l, lo);
      right_r = max(right_r, (long long)a[i].lo);
    }
  }
  if (!left || !right) return false;
  if ((left_l > left_r) || (right_l > right_r)) return false;
  return !(left_l > right_r || right_l > left_r);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setiosflags(ios::fixed) << setprecision(12);
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i].lo >> a[i].v >> a[i].dir;
  double l = 0, r = 1e6;
  for (int i = 1; i <= 100; i++) {
    double m = (l + r) / 2;
    if (check(m))
      r = m;
    else
      l = m;
  }
  cout << r << endl;
  return 0;
}
