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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {

    static int n;
    static double lightSpeed;
    static Double[] position, speed;
    static Integer[] dir;

    static double max = 1000000;

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in),81920);
        StringTokenizer st = new StringTokenizer(br.readLine());

        n = Integer.valueOf(st.nextToken());                 //n people
        lightSpeed = Integer.valueOf(st.nextToken());        //speed of ray

        position = new Double[n];            //position of i-th people
        speed = new Double[n];               //speed of i-th people
        dir = new Integer[n];                 //direction of i-th people

        for (int i = 0; i < n; i++) {                   //input of position, speed, dir
            String[] ar = br.readLine().split(" ");
            position[i] = Double.valueOf(ar[0]);
            speed[i] = Double.valueOf(ar[1]);
            dir[i] = Integer.valueOf(ar[2]);            //1 = left , 2 right
        }

        //binary search time
        double L = 0, R = max;
        for (int i = 0; i < 40; i++) {
            double mid = (L + R) / 2;
            //debuginfo("time expected : " + mid + " , lightSpeed :" + lightSpeed);
            if (check(mid)) R = mid;
            else L = mid;
            //debuginfo("");
        }
        //debuginfo("L=" + L + ",R=" + R);

        System.out.println((L + R) / 2);
    }

    public static boolean check(double time){
        List<Node> list = new ArrayList<>(2 * n);
        int a = 0, b = 0;
        for (int i = 0; i < n; i++) {
            double p = position[i], v = speed[i];
            int d = dir[i];
            double pp = d == 1 ? p : max - p;


            //debuginfo("(pos,vi,dir)" + "(" + p + " , " + v + " , " + d + ")");

            double to;
            if (pp / (v + lightSpeed) > time) {     //始终不可能的话那么跳过
                continue;
            }
            if (pp / v <= time) {       //计算区间
                pp = 0;
                to = max;

                if (d == 1) a ++;
                else b ++;
            } else {
                to = (lightSpeed * lightSpeed - v * v) * time / lightSpeed + v * pp  / lightSpeed;
                if (to > max) to = max;
            }

            //debuginfo((to < pp ? "      " : "") + "from=" + pp + " , to = " + to);

            double open = pp, close = to;
            if (d == 2){    // right
                open = max - to; close = max - pp;
            }

            //debuginfo((to < pp ? "      " : "") + "open=" + open + " , close = " + close);

            if (to < pp) continue;
            
            list.add(new Node(d, 1, (int)Math.ceil(open)));
            list.add(new Node(d, -1, (int)Math.floor(close)));
        }

        if (a > 0 && b > 0) return true;

        Collections.sort(list, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                if(o1.pp != o2.pp){
                    return o1.pp - o2.pp;
                }
                return o2.vv - o1.vv;
            }
        });

        //debuginfo(list);


        for (Node node : list) {
            if (node.dd == 1) {
                a += node.vv;
            } else {
                b += node.vv;
            }
            if (a > 0 && b > 0) return true;
        }

        return false;
    }
    
    static boolean DEBUG = false;
    
    public static void debuginfo(Object s){
        if (DEBUG){
            System.out.println(s);
        }
    }
}

class Node {
    int dd;
    int vv;
    int pp;
    public Node(int _dir, int _v, int _x){
        dd = _dir;
        vv = _v;
        pp = _x;
    }

    @Override
    public String toString() {
        return "position:" + pp + "," + (vv == 1 ? "open" : "close") + "," + (dd==1 ? "left" : "right");
    }
}