#include using namespace std; vector> factorize(long long n){ vector> fs; int k = 0; for (; n % 2 == 0; n /= 2, ++k); if (k > 0) fs.emplace_back(2, k); for (long long p = 3; p * p <= n; p += 2){ k = 0; for(; n % p == 0; n /= p, ++k); if (k > 0) fs.emplace_back(p, k); } if (n > 1) fs.emplace_back(n, 1); return fs; } int find_q(long long n, const vector> & fs){ int q = 1e9; for (const auto &pk : fs){ long long p = pk.first; int k = pk.second; long long nn = n; int kk = 0; for (; nn >= p; nn /= p, kk += nn); q = min(q, kk / k); } return q; } constexpr double pi = 3.14159265358979323846; int main() { long long n, m; cin >> n >> m; auto fs = factorize(m); int q = find_q(n, fs); // log(n!/(m**q)) = log(n!) - q * log(m) // = n log(n) - n + log(2*pi*n)/2.0 + 1/(12*n) - 1/(360*n*n*n) - q * log(m) double ans; ans = (n * (log(1.0 * n) - 1.0) + 0.5 * log(2.0 * pi * n) + 1.0/12.0/n - 1.0/360.0/n/n/n + 1.0/1260.0/n/n/n/n/n - q * log(1.0 * m)) * log10(exp(1.0)); long long d = floor(ans); ans -= d; double p = pow(10.0, ans); if (d < 0){ cout << "1e0" << endl; }else{ cout << p << 'e' << d << endl; } return 0; }