Factorial Mod P

VERY EASY · C · 2000ms

Statistics TA Oindrila is helping students with a combinatorics assignment. First question: compute N! modulo a large prime, since raw factorials overflow instantly. Read N and print N! mod (10^9+7).

Input

One integer N.

Output

N! mod (10^9+7).

Constraints

0 ≤ N ≤ 10^6

Sample Input

5

Sample Output

120
main.c
Loading editor…

Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.

Factorial Mod P · DIU ContestHub