#include #include #include #include using namespace std; long double factorial(long long x) { if (x <= 10000) { long double ret = 0; for (int i = 1; i <= x; i++) ret += log10(1.0L*i); return ret; } long double ans = 1.0L*x*(log(1.0L*x) - 1) / log(10.0L); long double dig = log10(1.0L * x); dig /= 2; ans += dig + 0.399L; return ans; } long long n, m; void calc(long double G) { long long T = (long long)(1.0L*G); G -= 1.0L*T; printf("%.10Lf", pow(10.0L, G)); cout << "e" << T << endl; } int main() { cin >> n >> m; long double E = factorial(n); long long I = m; vector>F; for (long long i = 2; i*i <= m; i++) { long long cnt = 0; while (I%i == 0) { I /= i; cnt++; } if (cnt >= 1) F.push_back(make_pair(i, cnt)); } if (I >= 2) F.push_back(make_pair(I, 1)); long long minx = (1LL << 60); for (int i = 0; i < F.size(); i++) { long long J = n, sum = 0; while (J >= 1) { J /= F[i].first; sum += J; } minx = min(minx, sum / F[i].second); } long double T = log10(1.0L*m); E -= 1.0L*T*minx; calc(E); return 0; }