import java.util.Scanner; public class No500 { public static void main(String[] args){ long N=0; Scanner sc = new Scanner(System.in); N = sc.nextLong(); culc(N); } static void culc(long N){ long mod = (long) Math.pow(10, 12); //1,000,000,000,000 boolean moreThan12Digits = false; long ans=1; for(int i=2; i<=N; i++){ ans *= i; if(moreThan12Digits && ans == 0)break; //下12桁が全て0になったら終了 if(ans >= mod){ ans %= mod; moreThan12Digits = true; } } if(moreThan12Digits){ System.out.printf("%012d\n", ans); }else{ System.out.println(ans); } } }