Given n cables with their lengths, you would like to connect all those cables together and obtain one big cable. To connect two cables with lengths x and y, you should pay x + y. After connecting those, the resulting cable has a length of x + y.

What is the minimum amount you would spend on connecting all the cables?

Input

The first line of the input contains a single integer n (1 ≤ n ≤ ) the number of cables.

The next line contains space-separated integers (1 ≤ ≤ ) the lengths of cables.

Output

The program should print the minimum amount you would spend on connecting those cables.