Running Total

Lab Python Beginner 10 points

Read a line of integers and print the running (cumulative) totals.

Input

One line of space-separated integers.

Output

One line, e.g. 1 3 6 10 for 1 2 3 4.

Example

Input

1 2 3 4

Output

1 3 6 10
Sample input available Sample output available
Editor
Python

Hints

Keep a running total and append it after each addition.

Solution explanation

itertools.accumulate does this for you (Standard Library chapter).

Show solution
total = 0
result = []
for x in map(int, input().split()):
    total += x
    result.append(total)
print(*result)
Output
Answer
HOME LEARN COMMUNITY DASHBOARD