Problem: n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed.

You can put a bomb in some point with non-negative integer coordinate, and blow it up. At this moment all people will start running with their maximum speed in the direction they are facing. Also, two strange rays will start propagating from the bomb with speed s: one to the right, and one to the left. Of course, the speed s is strictly greater than people's maximum speed.

The rays are strange because if at any moment the position and the direction of movement of some ray and some person coincide, then the speed of the person immediately increases by the speed of the ray.

You need to place the bomb is such a point that the minimum time moment in which there is a person that has run through point 0, and there is a person that has run through point 106, is as small as possible. In other words, find the minimum time moment t such that there is a point you can place the bomb to so that at time moment t some person has run through 0, and some person has run through point 106.

Input

The first line contains two integers n and s (2 ≤ n ≤ 105, 2 ≤ s ≤ 106) — the number of people and the rays' speed.

The next n lines contain the description of people. The i-th of these lines contains three integers xi, vi and ti (0 < xi < 106, 1 ≤ vi < s, 1 ≤ ti ≤ 2) — the coordinate of the i-th person on the line, his maximum speed and the direction he will run to (1 is to the left, i.e. in the direction of coordinate decrease, 2 is to the right, i.e. in the direction of coordinate increase), respectively.

It is guaranteed that the points 0 and 106 will be reached independently of the bomb's position.

Output

Print the minimum time needed for both points 0 and 106 to be reached.

Your answer is considered correct if its absolute or relative error doesn't exceed 10 - 6. Namely, if your answer is a, and the jury's answer is b, then your answer is accepted, if <image>.

Examples

Input

2 999
400000 1 2
500000 1 1


Output

500000.000000000000000000000000000000


Input

2 1000
400000 500 1
600000 500 2


Output

400.000000000000000000000000000000

Note

In the first example, it is optimal to place the bomb at a point with a coordinate of 400000. Then at time 0, the speed of the first person becomes 1000 and he reaches the point 106 at the time 600. The bomb will not affect on the second person, and he will reach the 0 point at the time 500000.

In the second example, it is optimal to place the bomb at the point 500000. The rays will catch up with both people at the time 200. At this time moment, the first is at the point with a coordinate of 300000, and the second is at the point with a coordinate of 700000. Their speed will become 1500 and at the time 400 they will simultaneously run through points 0 and 106.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int ni() {
  int val;
  scanf("%i", &val);
  return val;
}
pair<int, int> npi() {
  pair<int, int> val;
  scanf("%i %i", &val.first, &val.second);
  return val;
}
int64_t nll() {
  int64_t val;
  scanf("%I64d", &val);
  return val;
}
vector<int> nvi(int n, int corr = 0) {
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = ni() + corr;
  return move(a);
}
char nc() {
  char val;
  do {
    val = getchar();
  } while (val == ' ' || val == '\r' || val == '\n');
  return val;
}
char ncs() {
  char val;
  do {
    val = getchar();
  } while (false);
  return val;
}
string ns() {
  static char buff[1024 * 4000];
  scanf("%s", buff);
  return string{buff};
}
int64_t gcd(int64_t a, int64_t b) {
  while (b) {
    auto tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int64_t tr2(int xv1, int yv1, int xv2, int yv2, int x3, int y3) {
  return 1LL * (xv2 - xv1) * (y3 - yv1) - 1LL * (yv2 - yv1) * (x3 - xv1);
}
const long double eps = 1e-12;
const long double pi = acos(-1.0);
bool eq(long double a, long double b) { return abs(a - b) <= eps; }
int8_t bits_cnt[256];
vector<bool> prime;
vector<int> primes;
const string input_dir = "inputs\\";
string input_file = input_dir + "input.txt";
string output_file = input_dir + "output.txt";
void init_streams() {}
void init_data() {}
int get_bit_count(int v) {
  return bits_cnt[v & 0xFF] + bits_cnt[(v >> 8) & 0xFF] +
         bits_cnt[(v >> 16) & 0xFF] + bits_cnt[(v >> 24) & 0xFF];
}
struct Runner {
  int x, v, dir;
};
bool intersects(const pair<double, double>& lhs,
                const pair<double, double>& rhs) {
  return max(lhs.first, rhs.first) <= min(lhs.second, rhs.second);
}
void compress(vector<pair<double, double>>& ints) {
  if (ints.empty()) return;
  sort((ints).begin(), (ints).end());
  int sz = 0;
  for (int i = 0; i < ints.size(); ++i) {
    if (ints[sz].second >= ints[i].first)
      ints[sz].second = max(ints[sz].second, ints[i].second);
    else
      ints[++sz] = ints[i];
  }
  ints.resize(sz + 1);
}
bool possible(double t, int s, const vector<Runner>& runners) {
  vector<pair<double, double>> left_ints;
  vector<pair<double, double>> right_ints;
  for (const auto& rn : runners) {
    auto is_left = rn.dir == 1;
    double d = is_left ? rn.x : (1e6 - rn.x);
    auto dt = 1.0 * d / rn.v;
    if (dt <= t) {
      if (is_left)
        left_ints.emplace_back(make_pair(0.0, 1e6));
      else
        right_ints.emplace_back(make_pair(0.0, 1e6));
    } else {
      auto A = (1.0 - 1.0 * rn.v / s);
      auto B = (t * (rn.v + s) - d);
      auto rb = min(floor(d + A * B), 1e6);
      if (rb >= d) {
        if (!is_left) {
          rb = 1e6 - rb;
          d = 1e6 - d;
        }
        if (is_left)
          left_ints.emplace_back(make_pair(d, rb));
        else
          right_ints.emplace_back(make_pair(rb, d));
      }
    }
  }
  compress(left_ints);
  compress(right_ints);
  for (int i = 0; i < left_ints.size(); ++i) {
    auto lb =
        lower_bound((right_ints).begin(), (right_ints).end(), left_ints[i]);
    if (lb != right_ints.end() && intersects(left_ints[i], *lb) ||
        lb != right_ints.begin() && intersects(left_ints[i], *(lb - 1)))
      return true;
  }
  return false;
}
int main() {
  init_streams();
  init_data();
  auto n = ni(), s = ni();
  vector<Runner> runners(n);
  for (int i = 0; i < n; ++i) {
    auto x = ni(), v = ni(), t = ni();
    runners[i] = Runner{x, v, t};
  }
  double lt = 0, rt = 1e6;
  int steps = 75;
  while (steps--) {
    auto mid = (lt + rt) * .5;
    if (possible(mid, s, runners))
      rt = mid;
    else
      lt = mid;
  }
  cout << std::fixed << std::setprecision(12) << rt << endl;
  return 0;
}