n = gets.to_i if 50 <= n puts "0"*12 exit end p ((1..n).inject :*) % 1000000000000