#C8007. Alternating Sums

    ID: 51942 Type: Default 1000ms 256MiB

Alternating Sums

Alternating Sums

Given an array of positive integers representing the weights of players, assign them alternately to two teams and calculate the sum of weights for each team. The first weight is given to team 1, the second to team 2, the third to team 1, etc.

Formally, if the input array is \(a_1, a_2, \dots, a_n\), then compute the sums:

\(S_1 = \sum_{i \text{ odd}} a_i\) and \(S_2 = \sum_{i \text{ even}} a_i\). If there are no elements, both sums are 0.

Read the input from standard input and write the output to standard output.

inputFormat

The input begins with an integer \(N\) (\(0 \le N \le 10^5\)) on the first line, representing the number of players. If \(N > 0\), the second line contains \(N\) positive integers representing the weights of the players, separated by spaces.

outputFormat

Output a single line with two integers separated by a space: the total weight of team 1 and the total weight of team 2.

## sample
4
50 60 70 80
120 140

</p>