Setting

A Japanese young girl went to a Science Fair at Tokyo. There she met with a Robot named Mico-12, which had AI (You must know about AI-Artificial Intelligence). The Japanese girl thought, she can do some fun with that Robot. She asked her, "Do you have any idea about maths?". "Yes! I love mathematics", the Robot replied.

"Okey! Then I am giving you a number, you have to find out the Factorial of that number. Then find the sum of the digits of your result!. Suppose the number is 5. You first calculate 5! = 120, then find the sum of the digits 1 + 2 + 0 = 3. Can you do it?"

"Yes. I can do!", the Robot replied.

"Suppose the number is 100, what will be the result?". At this point the Robot started thinking and calculating. After a few minutes the Robot head burned out and it cried out loudly "Time Limit Exceeds".

The girl laughed at the Robot and said "The sum is definitely 648".

"How can you tell that?", the Robot asked the girl. "Because I am an ACM World Finalist and I can solve the Big Number problems easily".

Saying this, the girl closed her laptop computer and went away. Now, your task is to help the Robot with the similar problem.

Input

The input file will contain one or more test cases. Each test case consists of one line containing an integers n (n <= 1000).

Output

For each test case, print one line containing the required number. This number will always fit into an integer, i.e. it will be less than 2^31 - 1.

Sample Input

5
60
100


Sample Output

3
288
648


This challenge is provided by the ACM International Collegiate Programming Contest.

Statistics

 Difficulty (4 votes) Average test runtime 0.58 Points (changes over time) 10 Tried by 13 users Solved by 13 users

Global ranking

# Name Runtime Points worth
1 Justin 0.12 19
2 ,s/java/NaN/gi 0.14 16
3 Pascal 0.15 15
4 Mac 0.15 15
5 JB 0.16 14
6 Irfan 0.22 10
7 Phatti McButterpants 0.23 10
8 Dark 0.31 7
9 IeM 0.41 6
10 Skøgland 0.43 5
11 Nis 0.43 5
12 KnorpelSenf 0.45 5
13 AlexanderP 4.30 1