#include <bits/stdc++.h>
using namespace std;
int N, S;
double L[1010101], R[1010101];
int X[101010], V[101010], T[101010];
int LL[1010000], RR[1010000];
int ok(double TT) {
  memset(LL, 0, sizeof(LL));
  memset(RR, 0, sizeof(RR));
  int i;
  for (i = 0; i < (N); i++) {
    if (T[i] == 1) {
      if (X[i] * 1.0 / V[i] - 1e-9 <= TT)
        LL[0]++;
      else if (X[i] * 1.0 / (S + V[i]) - 1e-9 <= TT) {
        LL[X[i]]++;
        double a = TT * (V[i] + S) - X[i];
        double y = a * (S - V[i]) / S;
        LL[min(1000001LL, X[i] + (signed long long)floor(y) + 1)]--;
      }
    } else {
      if ((1000000 - X[i]) * 1.0 / V[i] - 1e-9 <= TT)
        RR[1000000]++;
      else if ((1000000 - X[i]) * 1.0 / (S + V[i]) - 1e-9 <= TT) {
        RR[X[i]]++;
        double a = TT * (V[i] + S) - (1000000 - X[i]);
        double y = a * (S - V[i]) / S;
        if (X[i] - floor(y) - 1 >= 0)
          RR[X[i] - (signed long long)floor(y) - 1]--;
      }
    }
  }
  for (i = 1; i <= 1000000; i++) LL[i] += LL[i - 1];
  for (i = 1000000; i >= 0; i--) RR[i] += RR[i + 1];
  for (i = 0; i < (1000001); i++)
    if (LL[i] && RR[i]) return 1;
  return 0;
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> S;
  for (i = 0; i < (N); i++) cin >> X[i] >> V[i] >> T[i];
  double L = 0, R = 1e6;
  for (i = 0; i < (60); i++) {
    double M = (L + R) / 2;
    if (ok(M))
      R = M;
    else
      L = M;
  }
  (void)printf("%.12lf\n", L);
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
