#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
const long double eps = 1e-9;
vector<array<int, 2> > fv, gv;
int s, f[N + 1], g[N + 1];
int compute(long long x, long long v, long double T) {
  long long ret = (T * s * s - T * v * v + x * v) / s;
  ret = min(ret, (s * x) / v);
  if (ret > N) ret = N;
  return ret;
}
bool check(long double T) {
  memset(f, 0, sizeof(f));
  for (auto ar : fv) {
    if (ar[0] <= ar[1] * T) {
      f[0]++;
      continue;
    }
    int lo = ar[0];
    int hi = compute(ar[0], ar[1], T);
    if (lo > hi) continue;
    f[lo]++;
    if (hi < N) f[hi + 1]--;
  }
  memset(g, 0, sizeof(g));
  for (auto ar : gv) {
    if (N - ar[0] <= ar[1] * T) {
      g[0]++;
      continue;
    }
    int lo = N - compute(N - ar[0], ar[1], T);
    int hi = ar[0];
    if (lo > hi) continue;
    g[lo]++;
    if (hi < N) g[hi + 1]--;
  }
  if (f[0] && g[0]) return true;
  for (int i = 1; i <= N; i++) {
    f[i] += f[i - 1];
    g[i] += g[i - 1];
    if (f[i] && g[i]) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(32);
  int n;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    int x, v, t;
    cin >> x >> v >> t;
    if (t == 1) {
      fv.push_back({x, v});
    } else {
      gv.push_back({x, v});
    }
  }
  long double lo = 0, hi = 2e6;
  while (abs(hi - lo) > eps) {
    long double mi = (lo + hi) / 2;
    if (check(mi))
      hi = mi;
    else
      lo = mi;
  }
  cout << lo << '\n';
  return 0;
}
