import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); double n = sc.nextDouble(); double m = sc.nextDouble(); long c = Long.MAX_VALUE; ArrayList lis = flis((long) (m + 1e-9)); for (long[] f : lis) { long tmp = 0; long n_ = (long) (n + 1e-9); while (n_ > 1) { tmp += n_ / f[0]; n_ /= f[0]; } c = Math.min(c, tmp / f[1]); } if (n < 170) { double ret = 1; for (int i = 2; i <= n; ++i) { ret *= i; } while (ret % m == 0) ret /= m; int cnt = 0; while (ret >= 10) { ++cnt; ret /= 10; } System.out.println(ret + "e" + cnt); return; } ++n; double v = (Math.log10(Math.sqrt(2 * Math.PI)) + n * Math.log10(n / Math.E) - 0.5 * Math.log10(n) + Math.log10(1 + 1 / (12 * n) + 1 / (288 * n * n) - 139 / (51840 * n * n * n))) - c * Math.log10(m); System.out.println(Math.pow(10, v - (long) v) + "e" + (long) v); } ArrayList flis(long n) { ArrayList ret = new ArrayList<>(); for (long i = 2; i * i <= n; ++i) { if (n % i == 0) { int c = 0; while (n % i == 0) { n /= i; ++c; } ret.add(new long[] { i, c }); } } if (n > 1) ret.add(new long[] { n, 1 }); return ret; } long pow(long a, long n) { long ret = 1; for (; n > 0; n >>= 1, a *= a) { if (n % 2 == 1) { ret *= a; } } return ret; } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }