Giai Thừa (v2)

PDF

Submit solution

Points: 10.00 (partial)
Time limit: 1.0s
Memory limit: 64M
Input: stdin
Output: stdout

Problem types
Allowed languages
C, C++, Java, Pascal, Python, Scratch, TEXT

Cho số nguyên không âm ~n~, người ta định nghĩa ~n~ giai thừa là: $$ n!=1\times 2\times 3\times … \times n $$ Quy ước ~0!=1~.

Yêu cầu

Cho biết giá trị số dư của phép chia ~n!~ cho ~1000000007 (10^9+7)~

Dữ liệu

Một dòng duy nhất gồm số nguyên không âm ~n~ ~(n\le 10^6)~.

Kết quả

Ghi ra một số nguyên duy nhất là giá trị số dư tìm được.

Input 1

6

Output 1

720

Input 2

16

Output 2

789741546

Comments

Please read the guidelines before commenting.


There are no comments at the moment.