{"raw_statement":[{"iden":"problem statement","content":"On a number line, there are $N$ fish swimming.\nFish $i$, which has a weight of $W_i$, is at the coordinate $X_i$ at time $0$ and moves at a speed of $V_i$ in the positive direction.\nTakahashi will choose an arbitrary real number $t$ greater than or equal to $0$ and do the following action at time $t$ just once.  \nAction: Choose an arbitrary real number $x$. Catch all fish whose coordinates are between $x$ and $x+A$, inclusive.\nFind the maximum total weight of fish that he can catch."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2000$\n*   $1 \\leq A \\leq 10^4$\n*   $1 \\leq W_i\\leq 10^4$\n*   $0 \\leq X_i\\leq 10^4$\n*   $1 \\leq V_i\\leq 10^4$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $A$\n$W_1$ $X_1$ $V_1$\n$W_2$ $X_2$ $V_2$\n$\\vdots$\n$W_N$ $X_N$ $V_N$"},{"iden":"sample input 1","content":"3 10\n100 0 100\n1 10 30\n10 20 10"},{"iden":"sample output 1","content":"111\n\nAt time $0.25$, fish $1$, $2$, and $3$ are at the coordinates $25$, $17.5$, and $22.5$, respectively. Thus, the action done at this time with $x=16$ catches all the fish."},{"iden":"sample input 2","content":"3 10\n100 100 100\n1 10 30\n10 20 10"},{"iden":"sample output 2","content":"100\n\nOne optimal choice is to do the action at time $0$ with $x=100$."},{"iden":"sample input 3","content":"4 10\n1000 100 10\n100 99 1\n10 0 100\n1 1 1"},{"iden":"sample output 3","content":"1110\n\nOne optimal choice is to do the action at time $1$ with $x=100$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}