Any Number of Arguments

Lab Python Intermediate 20 points

Write total(*nums) that returns the sum of any number of arguments. Read a line of integers and call total(*values); also print total() with no arguments.

Input

One line of integers.

Output

Two lines.

Example

Input

1 2 3 4

Output

10
0
Sample input available Sample output available
Editor
Python

Hints

*nums collects positional arguments into a tuple.

Solution explanation

*args in a definition packs arguments; *list in a call unpacks them.

Show solution
def total(*nums):
    result = 0
    for n in nums:
        result += n
    return result


values = list(map(int, input().split()))
print(total(*values))
print(total())
Output
Answer
HOME LEARN COMMUNITY DASHBOARD