import math n=int(input()) print(str(math.factorial(int(n)))[::-1][:12][::-1]if n<50 else '0'*12)