#C10237. Maximum Last Element
Maximum Last Element
Maximum Last Element
You are given an array of n integers. In one operation, you can combine elements in a way that ultimately results in a single element whose value is the sum of some or all elements of the array. As it turns out, the maximum possible value of the last remaining element is simply the sum of all the elements.
Mathematically, if the array is \(a_1, a_2, \dots, a_n\), the answer is given by:
\[ S = \sum_{i=1}^{n} a_i \]Your task is to compute \(S\).
inputFormat
The first line of the input contains a single integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.
Example:
4 1 2 3 4
outputFormat
Output a single integer which is the sum of all the elements in the array.
Example:
10## sample
4
1 2 3 4
10
</p>