#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long n, s;
long long x[101010], v[101010], t[101010];
inline long long getint() {
  long long ret;
  scanf("%lld", &ret);
  return ret;
}
void init() {
  n = getint();
  s = getint();
  for (int i = 0; i < n; i++) {
    x[i] = getint();
    v[i] = getint();
    t[i] = getint();
    if (t[i] == 2) x[i] = 1000000 - x[i];
  }
}
long long tg[1001021];
bool okay(double tar) {
  vector<pair<int, int> > v1, v2;
  for (int i = 0; i < n; i++)
    if (t[i] == 1) {
      if ((double)x[i] / v[i] < tar) {
        v1.push_back({0, 1000000});
        continue;
      }
      double bst = (double)x[i] / (v[i] + s);
      if (bst > tar) continue;
      double dlt = (tar - (double)x[i] / (s + v[i]));
      dlt /= (1. / (s - v[i]) - (double)v[i] / (s - v[i]) / (s + v[i]));
      int atmst = min(1000000LL, (long long)(x[i] + dlt));
      v1.push_back({x[i], atmst});
    } else {
      if ((double)x[i] / v[i] < tar) {
        v2.push_back({0, 1000000});
        continue;
      }
      double bst = (double)x[i] / (v[i] + s);
      if (bst > tar) continue;
      double dlt = (tar - (double)x[i] / (s + v[i]));
      dlt /= (1. / (s - v[i]) - (double)v[i] / (s - v[i]) / (s + v[i]));
      int atmst = min(1000000LL, (long long)(x[i] + dlt));
      v2.push_back({1000000 - atmst, 1000000 - x[i]});
    }
  for (int i = 0; i < 1001021; i++) tg[i] = 0;
  for (auto i : v1) {
    tg[i.first + 1]++;
    tg[i.second + 2]--;
  }
  for (int i = 1; i < 1001021; i++) tg[i] += tg[i - 1];
  for (int i = 1; i < 1001021; i++) tg[i] += tg[i - 1];
  for (auto i : v2)
    if (tg[i.second + 1] - tg[i.first] > 0) return true;
  return false;
}
void solve() {
  double l = 0, r = 1e7;
  for (int i = 0; i < 60; i++) {
    double mid = (l + r) * 0.5;
    if (okay(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.9f\n", (l + r) * 0.5);
}
int main() {
  init();
  solve();
}
