import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n,m = list(map(int, input().split())) import math def factor(n, m=None): # mを与えると、高々その素因数まで見て、残りは分解せずにそのまま出力する f = {} tmp = n M = int(-(-n**0.5//1))+1 if m is not None: M = min(m+1, M) for i in range(2, M+1): if tmp=k ans = 0 kk = k while kk<=v: ans += v//kk kk *= k return ans f2 = factor(m) val = float("inf") for k in f2: if k>n: val = 0 break val = min(val, divnum(n,k)//f2[k]) if n<10**6: ans = sum((math.log10(i) for i in range(1, n+1))) else: ans = math.log(2*math.pi*n)/2 + n*math.log(n) - n ans /= math.log(10) ans -= val * math.log10(m) v = math.pow(10, ans%1) # print(v) e = ans//1 print(f"{v}e{int(e)}") # print("{:e}".format(p))