시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB111100.000%

문제

Maksim, a well-known computer scientist in the field of networking, came up with a new protocol that Ramazan suggested to call cerr\_maksim.

For simplicity, let us say that there are two computers in the network, and they are connected with a wire of throughput $w$. Files are being transferred from the first computer to the second computer. Transferring a file of size $s$ takes $\frac{s}{w}$ seconds.

There are $n$ files to be transferred, each has a moment $t_i$ when it starts being transferred, size $s_i$ and priority $p_i$. If multiple files are being transferred simultaneously, then wire's throughput is divided between transfers proportionally to their priorities.

For each file, calculate the moment when it will reach the second computer.

입력

The first line contains two integers $n$, $w$ ($1 \le n \le 2 \cdot 10^5$, $1 \le w \le 10^7$) --- the number of files and wire's throughput.

Each of the next $n$ lines contains three integers $t_i$, $s_i$, $p_i$ ($1 \le t_i \le 10^7$, $1 \le s_i \le 10^7$, $1 \le p_i \le 100$) --- start time of the transfer, size and priority.

출력

Print $n$ real numbers, $i$-th number being the moment when the transfer of $i$-th file is completed.

Your answers will be considered correct if, for each of them, its absolute or relative error does not exceed $10^{-6}$.

예제 입력 1

2 10
0 100 2
4 200 1

예제 출력 1

13
30

예제 입력 2

2 10
30 200 1
10 100 2

예제 출력 2

50
20