#C5109. Minimum Possible Array Value

    ID: 48722 Type: Default 1000ms 256MiB

Minimum Possible Array Value

Minimum Possible Array Value

You are given an array of n integers. In each operation, you can select any two numbers and replace them with their sum. After repeating this process until only one number remains, the value of the final number is the result of the operations. Prove that no matter which pairs you add at each step, the final value is the sum of all the numbers in the array, i.e. \(S = \sum_{i=1}^n a_i\).

Your task is to compute this final value for a given array.

inputFormat

The first line contains a single integer n (1 ≤ n ≤ 105), the number of elements in the array.

The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single integer, which is the sum of all the elements in the array.

## sample
3
1 2 3
6