n = gets.to_i if 100 <= n p 0 exit end p ((1..n).inject :*) % 1000000000000