20222208 - n的n次方

a=1 n=int(input()) for i in range(n):

a=(a*n)%1000

print('%03d'%a)