#K39512. Maximum Card Sum

    ID: 26437 Type: Default 1000ms 256MiB

Maximum Card Sum

Maximum Card Sum

You are given a list of integers representing the values on a series of cards. Your task is to compute the maximum possible sum by summing only the positive card values and ignoring the negative ones. Formally, if the list of cards is \( a_1, a_2, \dots, a_n \), you should output \( \sum_{i=1}^{n} \max(a_i, 0) \).

Example: For the input list [4, -1, 2, -3, 5, -2], the answer is 11.

Note: The input is provided via standard input and the output is expected on standard output.

inputFormat

The first line of input contains a single integer \( n \) (the number of cards). The second line contains \( n \) space-separated integers representing the values on the cards.

For example:

6
4 -1 2 -3 5 -2

outputFormat

Output a single integer which is the sum of all positive integers in the input list.

For the above example, the output will be:

11
## sample
6
4 -1 2 -3 5 -2
11

</p>