e-olymp
Competitions

2018 Innopolice First Stage, December 1

Stones Distribution

There is an amazingly equipped hi-tech sauna in Innopolis sport center. However, due to complex techniques were used while building it people are not sure how to maintain it properly.

There are n - 1 consecutive compartments in the sauna. Between each pair of adjacent compartments, there is a stove. There are two more stoves: one connected only to the first compartment, and one connected only to the last, which makes exactly n stoves.

The i-th compartment has volume ki. Each stove can have from 0 to v stones. Let pi be the number of stones in thei-th stove, then the i-th compartment receives ki * pi * pi+1 units of heat.

There are s stove stones in sport center. Sport center management wants to minimize the sum of heat received by all compartments, so the rest of the building would not be heated up, but all stones have to be used as it is a waste to buy them otherwise. Help them solve the problem.

Input

The first line contains three integers n, s and v (2n1000, 1v105, sn * v) - number of stoves, number of stones and stove capacity, respectively.

The second line contains n - 1 integers ki - the volume of the i-th compartment (1ki105).

Output

Print the minimum possible total heat received by all compartments.

Explanation

In the example the correct answer is achieved if we put four stones into the first and the fourth stove, and two stones into the second. Then the heat in all compartments, except the first, will be zero, and in the first - eight.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4 10 4
1 2 3
Output example #1
8
Source 2018 Innopolice First Stage, December 1