nnn
0
For this input, the required output is 1.
1
5
For this input, the required output is 120.
120
10
For this input, the required output is 3628800.
3628800
1000
For this input, the required output is 641419708.
641419708
The factorial of nnn is defined as:
Given nnn, compute n!mod (109+7)n! \mod (10^9 + 7)n!mod(109+7).
n!mod (109+7)n! \mod (10^9 + 7)n!mod(109+7)