시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 2 2 2 100.000%

문제

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 $k_i$. Each stove can have from 0 to $v$ stones. Let $p_i$ be the number of stones in the $i$-th stove, then the $i$-th compartment receives $k_i \cdot p_i \cdot p_{i + 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.

입력

The first line contains three integers $n$, $s$ and $v$, number of stoves, number of stones and stove capacity, respectively ($2 \le n \le 1000$, $1 \le v \le 10^5$, $s \le n \cdot v$).

The second line contains $n - 1$ integers $k_i$, the volume of the $i$-th compartment ($1 \le k_i \le 10^5$).

출력

Print the minimum possible total heat received by all compartments.

서브태스크

번호 배점 제한
1 15

$n \le 1000$, $v = 1$

2 25

$n \le 50$, $v \le 50$

3 30

$n \le 200$, $v \le 100$

4 30

$n \le 1000$, $v \le 10^5$

예제 입력 1

4 10 4
1 2 3

예제 출력 1

8

힌트

Correct answer for the sample is achieved by putting four stones in the first and the last stove and by putting two stones in the second. After that, the heat in every compartment except second is equal to zero, while the heat in the second compartment is equal to $8$.

채점 및 기타 정보

  • 예제는 채점하지 않는다.