#C4170. Maximum Possible Value
Maximum Possible Value
Maximum Possible Value
You are given an array of integers. You can combine any two integers by adding them together and replacing them with their sum. This operation can be performed any number of times until only one integer remains. The objective is to determine the maximum possible value of the final integer.
In fact, since addition is both commutative and associative, the maximum value is simply the sum of all the integers in the array.
inputFormat
The first line of input contains a single integer n
(1 ≤ n ≤ 105), representing the number of elements in the array. The second line contains n
space-separated positive integers, where each integer ai
(1 ≤ ai ≤ 109) is an element of the array.
outputFormat
Output a single integer – the maximum possible value of the final integer after combining the array elements through addition.
## sample1
5
5
</p>