#P3198. [HNOI2008] 遥远的行星

[HNOI2008] 遥远的行星

Description

There are NN planets on a line; planet ii is located at position X=iX = i. Planet JJ is affected by the force from planet II if and only if iAJi \le A J. In this case, the magnitude of the force on JJ is Fi>j=Mi×MjjiF_{i->j}=\frac{M_i \times M_j}{j-i}.

Here AA is a very small constant, so intuitively each planet is only affected by planets that are far away. Compute the force on each planet. The answer is accepted if the relative error does not exceed 5%.

Input Format

The first line contains an integer NN and a real number AA.
The next NN lines contain the masses MiM_i of the NN planets.

Output Format

Output NN lines, the force on each planet in order.

5 0.3
3
5
6
2
4
0.000000
0.000000
0.000000
1.968750
2.976000

Hint

1N1051 \le N \le 10^5.
0.01<A0.350.01 < A \le 0.35.
0Mi1070 \le M_i \le 10^7.

Translated by ChatGPT 5