All problems

Problem 774

Product of Digits

Easy · 10 pts · Math, Basics

Problem

Multiply together all the digits of a non-negative integer N and print the result. If any digit is 0 the product is 0, and the product of the digits of 0 itself is 0. Take the last digit with N mod 10 and remove it with N / 10, repeating until nothing is left. The product of 18 nines is about 1.5 × 10^17, so use a 64-bit integer.

Input

A single integer N without leading zeros.

Output

Print the product of the digits of N.

Constraints

0 <= N <= 10^18

Example input

234

Example output

24

Explanation

The digits of 234 are 2, 3 and 4, and 2 × 3 × 4 = 24, so the answer is 24.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Count Digits Next: Positive, Negative or Zero