import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); if(N>=50){ System.out.println("000000000000"); }else{ long Z = 1; boolean boo = false; long mod = (long)Math.pow(10,12); for(int i=1; i<=N; i++){ Z*=i; if(Z>=mod)boo=true; Z%=mod; } if(boo){ System.out.println(String.format("%012d",Z)); }else{ System.out.println(Z); } } } }