Given an array of integers and an integer . Find the minimum cost to reduce the array to a single element. You can perform the following operation any number of times:
Choose any pair of consecutive elements a_i and a_{i+1}, and replace them with (a_i + a_{i+1}). The cost of this operation is k \cdot (a_i + a_{i+1}).
The first line contains two integers and k~(n, k \le 100). The second line contains integers a_1, a_2, \ldots, a_n~(0 \le a_i \le 100).
Print the minimum cost to reduce the array to a single element.
Example 2
Example 1