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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int s = in.nextInt();
            int[][] p = new int[n][4];
            for (int i = 0; i < n; i++) {
                p[i][0] = in.nextInt();
                p[i][1] = in.nextInt();
                p[i][2] = in.nextInt() - 1;
                if (p[i][2] == 0)
                    p[i][3] = p[i][0];
                else
                    p[i][3] = 1000000 - p[i][0];
            }
            double lo = 0.;
            double hi = 1000000.;
            outer:
            for (int j = 1; j <= 50; j++) {
                double mid = (lo + hi) / 2.;
                ArrayList<Integer[]> check = new ArrayList<Integer[]>();
                int[] cur = new int[2];
                for (int i = 0; i < n; i++) {
                    if (p[i][3] <= (long) p[i][1] * mid)
                        cur[(int) p[i][2]]++;
                    else if (p[i][3] <= (long) (p[i][1] + s) * mid) {
                        double v1 = 1. / (s - p[i][1]) - (double) p[i][1] / (s - p[i][1]) / (s + p[i][1]);
                        double v2 = (double) p[i][3] / (s + p[i][1]) - mid;
                        double v3 = -v2 / v1;
                        if ((int) p[i][2] == 0) {
                            check.add(new Integer[]{p[i][0], 1, p[i][2]});
                            check.add(new Integer[]{(int) Math.round(Math.min(1000001., Math.floor(p[i][0] + v3))), -1, p[i][2]});
                        } else {
                            check.add(new Integer[]{(int) Math.round(Math.max(-1., Math.ceil(p[i][0] - v3))), 1, p[i][2]});
                            check.add(new Integer[]{p[i][0], -1, p[i][2]});
                        }
                    }
                }
                if (cur[0] > 0 && cur[1] > 0) {
                    hi = mid;
                    continue outer;
                }
                Collections.sort(check, new Comparator<Integer[]>() {

                    public int compare(Integer[] o1, Integer[] o2) {
                        if (o1[0].compareTo(o2[0]) == 0)
                            return o2[1] - o1[1];
                        return o1[0] - o2[0];
                        //if ((int) o1[0] != (int) o2[0])
                        //    return o1[0] < o2[0] ? -1 : 1;
                        //return o1[1] < o2[1] ? 1 : -1;
                    }
                });
                for (Integer[] tmp : check) {
                    cur[tmp[2]] += tmp[1];
                    if (cur[0] > 0 && cur[1] > 0) {
                        hi = mid;
                        continue outer;
                    }
                }
                lo = mid;
            }
            out.printf("%.30f", (lo + hi) / 2.);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[16384];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}