Calculating the sum of digits of the factorial of a number N

JavaScript Hard math

Task «Calculating the sum of digits of the factorial of a number N»

Write a program that calculates the sum of the digits of the factorial of a given number N. The factorial of a number N (denoted as N!) is equal to the product of all natural numbers from 1 to N inclusive. Given that N can be quite large (up to 1000), the factorial may contain thousands of digits. It is necessary to calculate the sum of all digits of this number. Use BigInt to work with large numbers. It is guaranteed that N is an integer, non-negative, and does not exceed 1000.

Input Format

One integer N (0 ≤ N ≤ 1000).

Output Format

One integer — the sum of the digits of the factorial of N.

Examples

Example 1

INPUT
10
OUTPUT
27

Example 2

INPUT
2 10
OUTPUT
7

Example 3

INPUT
0
OUTPUT
1

Example 4

INPUT
5 0
OUTPUT
1
main.js