#CCBCHHAI0000017. Mã dừng có thể đến ngay (Sum Until Zero)

Mã dừng có thể đến ngay (Sum Until Zero)

Sum Until Zero

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Read integers in order. The first zero terminates the sequence. Compute the sum of all values preceding it, without reading beyond it. If the first value is zero, the sum is zero; the sum may be negative.

Input

A sequence of 1 to 100001100001 integers ending with zero; no earlier value is zero. There are at most 100000100000 nonzero values, each within [−1000,1000][-1000,1000].

Output

Print one signed 64-bit integer: the sum before the terminating zero.

Subtasks

  • Subtask 1 (20%): At most 4 values before zero, each of absolute value at most 10.
  • Subtask 2 (30%): At most 99 values before zero, each of absolute value at most 100.
  • Subtask 3 (50%): At most 100000 values before zero, each of absolute value at most 1000.

Examples

Example 1

Input

0

Output

0

Explanation

The first input is the terminator, so no values are added and the answer stays zero.

Example 2

Input

7 -2 -3 0

Output

2

Explanation

The running sum is 0 → 7 → 5 → 2. Zero terminates the input.