/* -*- coding: utf-8 -*- * * 2365.cc: No.2365 Present of good number - yukicoder */ #include #include #include #include #include using namespace std; /* constant */ const int MAX_P = 100000; const int MOD = 1000000007; /* typedef */ typedef long long ll; typedef vector vi; typedef pair pii; typedef vector vpii; template struct MI { int v; MI(): v() {} MI(int _v): v(_v % MOD) {} MI(long long _v): v(_v % MOD) {} MI operator+(const MI m) const { return MI(v + m.v); } MI operator-(const MI m) const { return MI(v + MOD - m.v); } MI operator*(const MI m) const { return MI((long long)v * m.v); } MI &operator+=(const MI m) { return (*this = *this + m); } MI &operator-=(const MI m) { return (*this = *this - m); } MI &operator*=(const MI m) { return (*this = *this * m); } bool operator==(const MI m) const { return v == m.v; } bool operator!=(const MI m) const { return v != m.v; } MI pow(long long n) const { // a^n % MOD MI pm = 1, a = *this; while (n > 0) { if (n & 1) pm *= a; a *= a; n >>= 1; } return pm; } }; typedef MI mi0; typedef MI mi1; typedef unordered_map umimi1; /* global variables */ bool primes[MAX_P + 1]; /* subroutines */ int gen_primes(int maxp, vi &pnums) { fill(primes, primes + maxp + 1, true); primes[0] = primes[1] = false; int p; for (p = 2; p * p <= maxp; p++) if (primes[p]) { pnums.push_back(p); for (int q = p * p; q <= maxp; q += p) primes[q] = false; } for (; p <= maxp; p++) if (primes[p]) pnums.push_back(p); return (int)pnums.size(); } bool prime_decomp(int n, vi &pnums, vpii& pds) { pds.clear(); int pn = pnums.size(); for (int i = 0; i < pn; i++) { int pi = pnums[i]; if (pi * pi > n) { if (n > 1) pds.push_back(pii(n, 1)); return true; } if (n % pi == 0) { int fi = 0; while (n % pi == 0) n /= pi, fi++; pds.push_back(pii(pi, fi)); } } return false; } /* main */ int main() { vi pnums; gen_primes(MAX_P, pnums); int n; ll k; scanf("%d%lld", &n, &k); vpii pds; prime_decomp(n, pnums, pds); bool cont = false; umimi1 pfs; for (auto &pd: pds) { pfs[pd.first] = pd.second; if (pd.first > 3) cont = true; } while (k > 0 && cont) { cont = false; umimi1 pfs1; for (auto &pf: pfs) { int p = pf.first; mi1 f = pf.second; if (p == 2) pfs1[3] += f; else if (p == 3) pfs1[2] += f * 2; else { vpii pds; prime_decomp(p + 1, pnums, pds); for (auto &pd: pds) { pfs1[pd.first] += f * pd.second; if (pd.first > 3) cont = true; } } } swap(pfs, pfs1); k--; } //for (auto &pf: pfs) printf("%d^%d ", pf.first, pf.second.v); //putchar('\n'); if (k > 0) { umimi1 pfs1; for (auto &pf: pfs) { int p = pf.first; mi1 f = pf.second; pfs1[p] += f * mi1(2).pow(k / 2); if (k & 1) { if (p == 2) pfs1[3] += f; else pfs1[2] += f * 2; } } swap(pfs, pfs1); } mi0 sum = 1; for (auto &pf: pfs) sum *= mi0(pf.first).pow(pf.second.v); printf("%d\n", sum.v); return 0; }