def scan; gets.split.map(&:to_i); end n = scan[0] r = 1 2.upto(n){|i| r=(i*r) if r.modulo(1000000000000)==0 puts "0"*12 exit end } p r.modulo(1000000000000)