#K80107. Maximize Score Game

    ID: 35457 Type: Default 1000ms 256MiB

Maximize Score Game

Maximize Score Game

Alice is playing an interesting game with a sequence of integers. In this game, she is allowed to perform a series of operations. At any step, she may:

  • Choose any subsequence of the current sequence, remove it, and then append the sum of the removed elements to the end of the sequence.
  • Stop the game at any moment and compute her score as the sum of all numbers remaining in the sequence.

The key observation is that the total sum of the sequence remains unchanged no matter how these operations are performed. Thus, the maximum score Alice can achieve is simply the sum of all elements in the original sequence, i.e., $$\sum_{i=1}^{n}a_i$$.

Your task is to help Alice compute this maximum score.

inputFormat

The first line of input contains an integer n representing the number of elements in the sequence.

The second line contains n space-separated integers, representing the sequence.

outputFormat

Output a single integer: the maximum score Alice can obtain, which is the sum of all the elements in the sequence.

## sample
5
1 2 3 4 5
15