require 'prime' N, M = gets.split.map &:to_i pes = Prime.prime_division(M) k = pes.map { |pe| f = lambda do |n, p| r = 0 z = p until n < p r += n / p p *= z end r end f[N, pe[0]] / pe[1] } .min log10ans = Math.lgamma(N + 1)[0] / Math.log(10) - k * Math.log10(M) puts "#{10 ** (log10ans - log10ans.to_i)}e#{log10ans.to_i}"