#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.special import loggamma N, M = map(int, read().split()) U = 10 ** 6 + 10 is_prime = np.zeros(U, np.bool_) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): if p * p > U: break if is_prime[p]: is_prime[p * p::p + p] = 0 primes = np.where(is_prime)[0] def factor(N): div = primes[N % primes == 0].tolist() for p in div: e = 0 while N % p == 0: N //= p e += 1 yield (p, e) if N > 1: yield (N, 1) def fact_ord(p, N): ret = 0 while N: N //= p ret += N return ret T = N + 10 for p, e in factor(M): f = fact_ord(p, N) if T > f // e: T = f // e log_x = (loggamma(N + 1) - T * np.log(M)) d = int(log_x // np.log(10)) log_x -= np.log(10) * d x = np.exp(log_x) print(f'{x:.3f}e{d}')