#K73207. Sum of Positives and Negatives
Sum of Positives and Negatives
Sum of Positives and Negatives
You are given a list of integers. Your task is to compute two values:
1. The sum of all positive integers; 2. The sum of all negative integers.
In mathematical terms, if the list is \(a_1, a_2, \dots, a_n\), you need to compute
\(S_{pos} = \sum_{\{i \mid a_i > 0\}} a_i\) and \(S_{neg} = \sum_{\{i \mid a_i < 0\}} a_i\).
If there are no positive (or negative) numbers, the corresponding sum should be 0.
Input will be given via standard input and your result should be printed to standard output.
inputFormat
The first line contains an integer \(n\) representing the number of elements in the list. The second line contains \(n\) space-separated integers.
outputFormat
Output a single line with two integers separated by a space: the sum of the positive numbers and the sum of the negative numbers.
## sample5
1 2 3 4 5
15 0
</p>