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 = Integer.MAX_VALUE; ArrayList lis = plis((long) m); for (long p : lis) { long tmp = 0; for (int i = 1; i < 1000; ++i) tmp += n / Math.pow(p, i); c = Math.min(c, tmp); } 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 plis(long n) { long ori = n; ArrayList ret = new ArrayList<>(); for (long i = 2; i * i <= n; ++i) { if (n % i == 0) { while (n % i == 0) { n /= i; } ret.add(i); } } ret.add(n); return ret; } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }