import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long Z = 1; long mod = (long)Math.pow(10,12); for(int i=1; i<=N; i++){ Z*=i; Z%=mod; if(Z==0)break; } System.out.println(Z); } }