#C10507. Maximize Sum of Elements

    ID: 39720 Type: Default 1000ms 256MiB

Maximize Sum of Elements

Maximize Sum of Elements

You are given a sequence of N integers. In one operation, you can select any two consecutive elements and replace them with their sum. This operation reduces the length of the sequence by 1. After performing exactly N-1 operations, only one number remains.

Your task is to determine the maximum possible value of the final element. Mathematical analysis shows that the maximum value is achieved by summing up all the numbers. In other words, if the sequence is \(a_1, a_2, \ldots, a_N\), then the answer is \(a_1 + a_2 + \cdots + a_N\).

The input consists of multiple test cases.

inputFormat

The first line contains an integer \(T\), the number of test cases. For each test case:
- The first line contains an integer \(N\), the number of elements in the sequence.
- The second line contains \(N\) integers, representing the sequence.

outputFormat

For each test case, output a single line containing the maximum possible value of the final element.

## sample
2
3
1 2 3
4
1 2 3 4
6

10

</p>