require 'prime' def f(n,m) r=0 while n>0 r+=n/=m end r end n,m=gets.split.map &:to_i k=m.prime_division.map{|x,p|f(n,x)/p}.min r=Math.lgamma(n+1)[0]/Math.log(10)-k*Math.log10(m) t=[0]*1000+(1000..10000).map{|i|Math.log10(i)} z=r.to_i r-=z-3 x=(0..10000).bsearch{|i|t[i]>r}-1 puts '%d.%de%d'%[x/1000,x%1000,z]