def fact(n) return 0 if n == 0 return 0 if n >= 50 (1..n).inject{|r, n| r * n} % 10**12 end N = gets.to_i puts fact(N)