#C6741. Sum of Factorial Digits

    ID: 50535 Type: Default 1000ms 256MiB

Sum of Factorial Digits

Sum of Factorial Digits

Given a non-negative integer ( n ), compute ( n! ) (the factorial of ( n )) and output the sum of the digits of ( n! ). The factorial ( n! ) is defined as ( n! = \prod_{i=1}^{n} i ) with the special case that ( 0! = 1 ). For example, when ( n = 5 ), we have ( 5! = 120 ) and the sum of the digits is ( 1+2+0 = 3 ).

inputFormat

The input consists of a single integer ( n ) (where ( n \geq 0 )) read from stdin.

outputFormat

Output a single integer representing the sum of the digits of ( n! ) to stdout.## sample

0
1