require'prime' n,m=gets.split.map &:to_i k=m.prime_division.map{|x,p|r=0;y=n;r+=y/=x while y>0;r/p}.min r=Math.lgamma(n+1)[0]/2.302585-k*Math.log10(m) x=(10**(r+3-z=r.to_i)).to_i puts'%fe%d'%[x/1000.0,z]