from math import factorial as fact N = int(input()) #50!は10で12回割り切れる。49!は11回。よって、50以上の整数xに対してx!の下12桁は全て0 if N >= 50: print('000000000000') else: f = fact(N) if len(str(f)) >= 12: print(str(f % (10 ** 12)).zfill(12)) else: print(f % (10 ** 12))