functools.reduce

Lab Python Intermediate 20 points

Read a line of integers and print their product using functools.reduce.

Input

One line.

Output

The product.

Example

Input

1 2 3 4 5

Output

120
Sample input available Sample output available
Editor
Python

Hints

reduce(f, items, start) combines items left to right.

Solution explanation

math.prod also exists, but reduce works for any combining operation.

Show solution
from functools import reduce

nums = map(int, input().split())
print(reduce(lambda a, b: a * b, nums, 1))
Output
Answer
HOME LEARN COMMUNITY DASHBOARD