#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
const int MAXX = 1000000;
const int MAXV = 1000000;
typedef struct P {
  int x, v, dir;
} P;
bool operator<(const P &a, const P &b) { return a.x < b.x; }
typedef struct E {
  int x;
  int kind, by;
} E;
bool operator<(const E &a, const E &b) {
  if (a.x != b.x) return a.x < b.x;
  return a.by > b.by;
}
int n, v;
P p[MAXN];
E e[4 * MAXN + 4];
int ne;
void addevent(double l, double r, int kind) {
  e[ne].x = l, e[ne].kind = kind, e[ne].by = +1, ++ne;
  e[ne].x = r, e[ne].kind = kind, e[ne].by = -1, ++ne;
}
bool ok(double t) {
  bool alwayslft = false;
  for (int i = (0); i < (n); ++i)
    if (p[i].dir == 1 && p[i].x - p[i].v * t <= 0) alwayslft = true;
  bool alwaysrgt = false;
  for (int i = (0); i < (n); ++i)
    if (p[i].dir == 2 && p[i].x + p[i].v * t >= MAXX) alwaysrgt = true;
  ne = 0;
  if (alwayslft) addevent(0, MAXX, 0);
  if (alwaysrgt) addevent(0, MAXX, 1);
  for (int i = (0); i < (n); ++i)
    if (p[i].dir == 1) {
      int px = p[i].x, pv = p[i].v;
      int cur = (int)floor(
          min(1.0 * MAXX, (t * v * v - t * pv * pv + 1.0 * px * pv) / v));
      if (cur >= px) addevent(px, cur, 0);
    }
  for (int i = (0); i < (n); ++i)
    if (p[i].dir == 2) {
      int px = MAXX - p[i].x, pv = p[i].v;
      int cur =
          MAXX - (int)floor(min(1.0 * MAXX,
                                (t * v * v - t * pv * pv + 1.0 * px * pv) / v));
      if (cur <= p[i].x) addevent(cur, p[i].x, 1);
    }
  sort(e, e + ne);
  int nlft = 0, nrgt = 0;
  for (int i = (0); i < (ne); ++i) {
    if (e[i].kind == 0)
      nlft += e[i].by;
    else
      nrgt += e[i].by;
    if (nlft > 0 && nrgt > 0) return true;
  }
  return false;
}
void run() {
  scanf("%d%d", &n, &v);
  for (int i = (0); i < (n); ++i) scanf("%d%d%d", &p[i].x, &p[i].v, &p[i].dir);
  sort(p, p + n);
  double l = 0, h = MAXX;
  for (int i = (0); i < (100); ++i) {
    double m = l + (h - l) / 2;
    if (ok(m))
      h = m;
    else
      l = m;
  }
  printf("%.9lf\n", (l + h) / 2);
}
int main() {
  run();
  return 0;
}
