#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005, MAXS = 1000005;
const double eps = 1e-8;
int x[MAXN], v[MAXN], t[MAXN];
int n, s;
int sum[MAXS], sd[MAXS];
bool judge(double T) {
  memset(sum, 0, sizeof sum);
  memset(sd, 0, sizeof sd);
  for (register int i = 1; i <= n; i++) {
    if (t[i] == 1) {
      if (x[i] <= v[i] * T)
        sum[0]++;
      else if (x[i] > (v[i] + s) * T + eps)
        continue;
      else {
        int L = x[i];
        long long dx =
            (long long)((T - L * 1.0 / (s + v[i])) /
                            (1.0 / (s - v[i]) -
                             v[i] * 1.0 / (1.0 * s * s - 1.0 * v[i] * v[i])) +
                        eps);
        dx = min(dx, (long long)(L * 1.0 * (s - v[i]) / v[i] + eps));
        sum[x[i]]++, sum[min(1000000ll, x[i] + dx) + 1]--;
      }
    } else if (t[i] == 2) {
      if ((1000000 - x[i]) <= v[i] * T)
        sd[0]++;
      else if ((1000000 - x[i]) > (v[i] + s) * T + eps)
        continue;
      else {
        int L = 1000000 - x[i];
        long long dx =
            (long long)((T - L * 1.0 / (s + v[i])) /
                            (1.0 / (s - v[i]) -
                             v[i] * 1.0 / (1.0 * s * s - 1.0 * v[i] * v[i])) +
                        eps);
        dx = min(dx, (long long)(L * 1.0 * (s - v[i]) / v[i] + eps));
        sd[max(x[i] - dx, 0ll)]++, sd[x[i] + 1]--;
      }
    }
  }
  for (register int i = 1; i <= 1000000; i++)
    sum[i] += sum[i - 1], sd[i] += sd[i - 1];
  for (register int i = 0; i <= 1000000; i++)
    if (sum[i] && sd[i]) {
      return 1;
    }
  return 0;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d%d%d", &x[i], &v[i], &t[i]);
  double l = 0, r = 1000000, mid;
  while (r - l >= eps) {
    mid = (l + r) / 2;
    if (judge(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.10f\n", (l + r) / 2);
  return 0;
}
