Big Factorials

IUB Beginners' Contest 20...
Limits 1s, 512 MB

Given an integer N, print the trailing 4 digits of N!N! (N factorial).

N!=N×(N1)×(N2)×...×1N! = N \times (N-1) \times (N-2) \times ... \times 1

Here are some examples of N!N! and their last 4 digits.

NN Factorial (N!N!)Last 4 Digits
366
750405040
11399168006800
1513076743680008000

Input

The input will contain an integer NN (0<N<10000 < N < 1000).

Output

Print the last 4 digits of N!N!.

Do not print any leading zeroes.

Samples

InputOutput
4
24
InputOutput
10
8800

Submit

Login to submit.

Contributors

Statistics

84% Solution Ratio
ashik_jiddneyEarliest, Nov '18
edge555Fastest, 0.0s
wasimur_01Lightest, 0 B
saitotaShortest, 36B
Toph uses cookies. By continuing you agree to our Cookie Policy.