import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan.close(); long x = 1; for(int i = 1; i <= N; i++) { x = x * i; String n = Long.toString(x); if(n.length() > 15) { x = Long.parseLong(n.substring(n.length() - 15, n.length())); } } String ans = Long.toString(x); if(ans.length() > 12) { ans = ans.substring(ans.length() - 12, ans.length()); } System.out.println(ans); } }