n = gets.to_i if n >= 50 puts "%012d" % 0 else x = 1 2.upto(n) do |i| x = x * i end if x >= 1000000000000 puts "%012d" % (x % 1000000000000) else puts x end end