Network Transfer

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

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 ww. Files are being transferred from the first computer to the second computer. Transferring a file of size ss takes sw\frac{s}{w} seconds.

There are nn files to be transferred, each has a moment t_it\_i when it starts being transferred, size s_is\_i and priority p_ip\_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 nn, ww (1n21051 \le n \le 2 \cdot 10^5, 1w1071 \le w \le 10^7) --- the number of files and wire's throughput.

Each of the next nn lines contains three integers t_it\_i, s_is\_i, p_ip\_i (1t_i1071 \le t\_i \le 10^7, 1s_i1071 \le s\_i \le 10^7, 1p_i1001 \le p\_i \le 100) --- start time of the transfer, size and priority.

출력

Print nn real numbers, ii-th number being the moment when the transfer of ii-th file is completed.

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