#CCBCHHAI0000035. Hồ sơ nhiều phiên (Multi-session Positive Totals)

Hồ sơ nhiều phiên (Multi-session Positive Totals)

Multi-session Positive Totals

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

The input contains consecutive sessions. Within a session, read integers until 0, then print the sum of positive numbers in that session (ignore negatives). The next integer starts another session. If -1 occurs as the first value of a new session, end the entire input without another output line. Inside an already-started session, -1 is merely a negative value. An empty session (0 first) has sum zero.

Input

A sequence of integers in [-100,100]. Every ordinary session ends with 0; the last integer is -1 at the beginning of a new session, with nothing after it.

Output

Print the sum of positive integers of each completed session on its own line. If there are no sessions, output is empty.

Subtasks

  • Subtask 1 (20%): At most 5 integers in the entire stream, ∣x∣≤10|x|\le10.
  • Subtask 2 (30%): At most 100 integers in the entire stream, ∣x∣≤100|x|\le100.
  • Subtask 3 (50%): At most 10000 integers in the entire stream, all in [-100,100].

Examples

Example 1

Input

1 -2 3 0
4 0
-1

Output

4
4

Explanation

First session sums 1 and 3 to 4 and ignores -2; the second sums to 4; the final -1 ends the entire stream.

Example 2

Input

0
2 -1 3 0
-1

Output

0
5

Explanation

The first session is empty, so output 0. Inside the second session -1 is an ordinary negative integer; sum 2+3=5.