Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Big Factorials

Limits: 1s, 512 MB

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

$ N! = N \times (N-1) \times (N-2) \times ... \times 1 $

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

N$ N! $Last 4 Digits
366
750405040
11399168006800
1513076743680008000

Input

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

Output

Print the last 4 digits of $ N! $.

Do not print any leading zeroes.

Samples

InputOutput
4
24
10
8800

Discussion
Submit

Login to submit