Add All
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
The cost of adding two numbers equals to their sum. For example to add and costs . The cost of addition and is . We can add numbers in several ways:
(cost = ), (cost = ). Total =
(cost = ), (cost = ). Total =
(cost = ), (cost = ). Total =
We hope you understood the task. You must add all numbers so that the total cost of summation will be the smallest.
Input
First line contains positive integer . Second line contains nonnegative integers, each no more than .
Output
Print the minimum total cost of summation.
Examples
Input #1
Answer #1
Submissions 10K
Acceptance rate 33%