#K75692. Taco Maximum Net Score

    ID: 34476 Type: Default 1000ms 256MiB

Taco Maximum Net Score

Taco Maximum Net Score

Given a sequence of scores, your task is to compute the maximum net score by selecting a non-contiguous subarray such that the sum is maximized. In this problem, the maximum net score is the sum of all positive scores. If all scores are negative, the maximum net score is defined to be 0.

The formula for the maximum net score is given by:

$$\text{maxNetScore} = \sum_{i=1}^{n} \max(0, s_i)$$

where \(s_i\) represents the ith score.

Read the input from stdin and print the computed value to stdout.

inputFormat

The input consists of two lines. The first line contains a single integer \(n\) representing the number of scores. The second line contains \(n\) space-separated integers representing the scores.

outputFormat

Output a single integer representing the maximum net score, which is the sum of all positive scores. If there are no positive scores, output 0.

## sample
5
1 -2 3 -4 5
9