#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int x[N], v[N], t[N];
vector<pair<int, int> > V1, V2;
int n, s;
long long xx[N * 10];
void update(int l, int r) { xx[l]++, xx[r + 1]--; }
long long query(int l, int r) { return xx[r] - xx[l - 1]; }
bool isok(double time) {
  for (int i = (0); i < (((int)(V1).size())); ++i) {
    double x = V1[i].first, v = V1[i].second;
    if (time * (v + s) < x)
      ;
    else if (time * v < x) {
      double len = x;
      double stime = (len - time * v) / s;
      double spoint = stime * (s + v);
      int _l = x, _r = min(floor(spoint + (time - stime) * s), 1e6);
      assert(_r >= _l);
      update(_l, _r);
    } else
      update(1, 1e6);
  }
  for (int i = (1); i < (1e6 + 1); ++i) xx[i] += xx[i - 1];
  for (int i = (1); i < (1e6 + 1); ++i) xx[i] += xx[i - 1];
  for (int i = (0); i < (((int)(V2).size())); ++i) {
    double x = V2[i].first, v = V2[i].second;
    if (x + time * (v + s) < 1e6)
      ;
    else if (x + time * v < 1e6) {
      double len = 1e6 - x;
      double stime = (len - time * v) / s;
      double spoint = stime * (s + v);
      int _l = max(1.0, ceil(1e6 - (spoint + (time - stime) * s))), _r = x;
      assert(_r >= _l);
      if (query(_l, _r)) return true;
    } else if (query(1, 1e6))
      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], &t[i]);
    if (t[i] == 1)
      V1.push_back(make_pair(x[i], v[i]));
    else
      V2.push_back(make_pair(x[i], v[i]));
  }
  double l = 0, r = 1e6;
  while (r - l > 1e-7) {
    memset(xx, 0, sizeof(xx));
    double mid = (l + r) / 2.0;
    if (isok(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.8lf\n", l);
  return 0;
}
