#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- typedef long long ll; map enumpr(ll n) { map V; for(ll i=2;i*i<=n;i++) while(n%i==0) V[i]++,n/=i; if(n>1) V[n]++; return V; } /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ ll N, M; //--------------------------------------------------------------------------------------------------- const double PI = 2 * acos(0.0), E = exp(1); // スターリングの近似公式を使ってlog10(n!)を計算する double log10facn(ll _n) { if (_n < 101010) { double res = 0; rep(i, 1, _n + 1) res += log10(i); return res; } double n = _n; return log10(2 * PI * N) / 2 + n * log10(n / E) + log10(1 + 1.0 / (12 * N)); } // a!をbで最大何回割り切れるかを求める ll legendreFormula(ll a, ll b) { auto e = enumpr(b); ll k = 1LL << 60; fore(p, e) { ll x = p.first; ll c = 0; while (x <= a) { c += a / x; x *= p.first; } k = min(k, c / (ll)p.second); } return k; } //--------------------------------------------------------------------------------------------------- void _main() { cin >> N >> M; ll k = legendreFormula(N, M); double a = log10facn(N); double b = log10(M); double n = a - b * k; ll d = floor(n); n -= d; double nn = pow(10, n); printf("%.10fe%lld\n", nn, d); }