Back to the Himalayas

Time limit: 0.2s Memory limit: 16MB Input: Output:

As the deer finds cold spring water, so do I find the money on top of the mountains! - Jany MooRANDy

It’s been so long since your favorite bomber Jany MooRANDy has been in the Himalayan Mountains and his enemies started questioning his abilities to make money. But have no worries, he’s back to the Himalayas to once again prove his claim: "Let the wind and rain blow, I make money in the Himalayas too! Where I make money packages, the enemies only collect stones!". After getting his PhD in physics proving that he has TDI brain he got to rename "the law of conservation of energy"to "the law of conservation of value".

It reads like this: the kinetic value of an object is equal to (mβ‹…v2)/2(m \cdot v^2)/2 (where mm is the mass of the object and vv is its velocity) and the potential value of an object is equal to mβ‹…gβ‹…hm \cdot g \cdot h (where mm is the mass of the object, gg is the gravitational acceleration which we will consider to be 1010, and hh is the difference of elevation between it and a reference point).

As we all know, the Himalayas are made up of NN peaks placed in a line, the ithi^{th} peak having an elevation of HiH_i. Now Jany MooRANDy wants to collect the money which the previously built stop points for the Himalayas cable car have made (there is a cable car stop in every peak). Starting from a peak ii he will only go to the right (i.e. i+1,i+2,...,Ni + 1, i + 2, ..., N).

Having loads of value, he will be on his journey with a kinetic value equal to (mβ‹…v2)/2(m \cdot v^2)/2 right from the beginning. When jumping from the ith peak to the (i+1)th(i + 1)^{th} peak he will either lose or gain value. If Hi>Hi+1H_i > H_{i+1} then he will gain mβ‹…gβ‹…(Hiβˆ’Hi+1)m \cdot g \cdot (H_i - H_{i+1}) value, otherwise he will lose mβ‹…gβ‹…(Hi+1βˆ’Hi)m \cdot g \cdot (H_{i+1} - H_i) value. Over the course of the journey, his value cannot drop below 00. Now, because he wants to make money packets he is wondering for every starting peak which is the farthest peak that he can go to?

Input

The first line contains three integers: N(1≀N≀5β‹…105),m(1≀m≀1050)N (1 ≀ N ≀ 5 \cdot 10^5), m (1 ≀ m ≀ 10^{50}) and v(1≀v≀4β‹…104)v (1 ≀ v ≀ 4 \cdot 10^4) – the number of peaks, Jany MooRANDy’s mass and speed respectively.
The second line contains NN integers, representing the HH array - the height of each peak. (1≀Hi≀109)(1 ≀ H_i ≀ 10^9).

For tests worth 3030 points, (1≀N≀1Β 0001 ≀ N ≀ 1 \ 000), mm (1≀m≀1091 ≀ m ≀ 10^9) and vv (1≀v≀4001 ≀ v ≀ 400) hold.
For tests worth extra 3030 points, (1≀N≀1Β 0001 ≀ N ≀ 1 \ 000), mm (1≀m≀10501 ≀ m ≀ 10^{50}) and vv (1≀v≀4β‹…1041 ≀ v ≀ 4 \cdot 10^4) hold.

Note that previous knowledge of the physics concepts presented is not required and the task is solvable using the given assumptions and definitions from the statement.

Output

The output will consist of one line, having NN integers, separated by a space: ans1,ans2,...,ansnans_1, ans_2, ..., ans_n where ansians_i is the index of the farthest peak Jany MooRANDy can reach starting from peak ii.

Example

stdin

9 2 7
3 2 1 5 3 3 8 2 1

stdout

6 3 3 6 6 6 9 9 9

Explanation

Let’s see why ans1=6ans_1 = 6
He starts from the first peak with kinetic value of (2β‹…72)/2=49(2 \cdot 72)/2 = 49, so his current value is 4949.

From peak 11 to peak 22, his value increases by mβ‹…gβ‹…(H1βˆ’H2)=2β‹…10β‹…1=20m \cdot g \cdot (H_1 βˆ’ H_2) = 2 \cdot 10 \cdot 1 = 20, so his current value becomes 69.
From peak 22 to peak 33, his value increases by mβ‹…gβ‹…(H2βˆ’H3)=2β‹…10β‹…1=20m \cdot g \cdot (H_2 βˆ’ H_3) = 2 \cdot 10 \cdot 1 = 20, so his current value becomes 89.
From peak 33 to peak 44, his value decreases by mβ‹…gβ‹…(H4βˆ’H3)=2β‹…10β‹…4=80m \cdot g \cdot (H_4 βˆ’ H_3) = 2 \cdot 10 \cdot 4 = 80, so his current value becomes 9.
From peak 44 to peak 55, his value increases by mβ‹…gβ‹…(H4βˆ’H5)=2β‹…10β‹…2=40m \cdot g \cdot (H_4 βˆ’ H_5) = 2 \cdot 10 \cdot 2 = 40, so his current value becomes 49.
From peak 55 to peak 66, his value decreases by mβ‹…gβ‹…(H5βˆ’H6)=2β‹…10β‹…0=0m \cdot g \cdot (H_5 βˆ’ H_6) = 2 \cdot 10 \cdot 0 = 0, so his current value stays the same.
From peak 66 to peak 77, his value decreases by mβ‹…gβ‹…(H7βˆ’H6)=2β‹…10β‹…5=100m \cdot g \cdot (H_7 βˆ’ H_6) = 2 \cdot 10 \cdot 5 = 100, so his current value would drop to 49βˆ’100=βˆ’5149 βˆ’ 100 = βˆ’51 which is below 00 so he can’t go to peak 77.
The farthest peak he can reach from peak 11 is peak 66.

Log in or sign up to be able to send submissions!