#C12099. Sum of Factorials

    ID: 41488 Type: Default 1000ms 256MiB

Sum of Factorials

Sum of Factorials

Given a single line input containing a comma-separated list of non-negative integers, compute the sum of the factorials of the given integers.

The factorial of a non-negative integer \( n \) is defined as follows:

\( n! = \prod_{i=1}^{n} i \) for \( n \ge 1 \) and \( 0! = 1 \).

For example, if the input is "1,2,3", then you should compute \(1! + 2! + 3! = 1 + 2 + 6 = 9\) and output 9.

inputFormat

The input is provided via standard input as a single line. The line contains a comma-separated list of non-negative integers.

outputFormat

Output a single integer which is the sum of the factorials of the integers given in the input.

## sample
1,2,3
9