Given an array of $n$ numbers, your task is to divide it into $n$ subarrays, each of which has a single element.
On each move, you may choose any subarray and split it into two subarrays. The cost of such a move is the sum of values in the chosen subarray.
What is the minimum total cost if you act optimally?
The first input line has an integer $n$ : the array size. The array elements are numbered $1,2,\dots,n$ .
The second line has $n$ integers $x_1,x_2,\dots,x_n$ : the contents of the array.
Print one integer: the minimum total cost.