import java.util.Scanner; public class Kaijocalc { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); long N = s.nextLong(); long ans = 1; StringBuilder str = new StringBuilder(); s.close(); long t = (long)Math.pow(10, 12); for(int i = 1;i <= N;i++){ ans *= i; if(ans > t){ str.append(ans); str.delete(0, str.length()-12); ans %= t; }else{ str.delete(0, str.length()); str.append(ans); } if(ans == 0){ str = new StringBuilder("0"); break; } } System.out.println(str); } }