Internet Trouble

Place 1 to N stations on a line of towns to minimize station cost plus weighted cable cost, where each house connects to the nearest station.

Hard8Dynamic programmingDivide and conquerPrefix sumGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

The government is bringing internet service to people in remote areas, in this case small towns that grew along a long, busy highway. NN towns sit side by side along the highway, and each town takes up exactly one kilometer of it. The towns are numbered 1 to NN in order along the highway.

To provide the service, the government builds access point stations with satellite links. Each station goes in a different town, and building one station costs BB. The government wants the service to be as good as possible, so every house is connected directly to one of these stations. Connecting a house in town ii to a station in town jj costs ij×C|i - j| \times C, where CC is the price of one kilometer of cable. Cable used inside a town is cheap enough to ignore, so a house in the town that holds the station it connects to pays no cable cost.

Given NN, BB, CC and the number of houses in each town, write a program that computes the minimum total cost of connecting every house in every town, counting both the stations and the cable. The government has not fixed the number of stations yet, so compute the minimum cost for 1, 2, \dots, NN stations.

Input

The first line contains three integers NN, BB and CC separated by spaces: the number of towns, the cost of building one access point station, and the price of one kilometer of cable (1N60001 \le N \le 6000, 1B1091 \le B \le 10^9, 1C1001 \le C \le 100).

The second line contains NN integers H1,H2,,HNH_1, H_2, \dots, H_N separated by spaces, where HiH_i is the number of houses in town ii (1Hi1091 \le H_i \le 10^9).

Output

Print NN integers on one line, separated by single spaces: the minimum total cost of connecting every house when 1, 2, \dots, NN access point stations are built.