Processing math: 100%

Problem I. Digitalization

Input file:input.txt   Time limit:2 sec
Output file:output.txt   Memory limit:64 Mb

Statement

Define the function sum_of_digits(a)aN0=ki=0ai where {ai} is the representation of a in the numeral system with radix 10.

Define the function:

digitalization(a)aN0={
ifsum_of_digits(a)0..9{
returnsum_of_digits(a)
}
else{
returndigitalization(sum_of_digits(a))
}
}

Your problem is to find digitalization(n!) for given n.

Input file format

n

Output file format

digitalization(n!)

Constraints

1n109

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
2
2
2
3
6

0.062s 0.007s 13