import java.util.Scanner; public class No500 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long result = 1; int cnt = 0; for(long i = 1;i <= N;i++) { result = result * i; String str = String.valueOf(result); if(str.length() > 12) { cnt++; str = str.substring(str.length() - 12,str.length()); } result = Long.parseLong(str); } if(cnt == 0) { System.out.println(result); }else { System.out.println(String.format("%012d", result)); } } }