#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) #include using mint = atcoder::modint1000000007; void operator<<(ostream& os, const mint& m) { os << m.val(); } int solve(int n, ll k) { Debug(n, k); vector> pf(0); for (int i = 2; i * i <= n; ++i) { if (n % i == 0) { pf.push_back({ i, 0 }); while (n % i == 0) { n /= i; pf.back().second++; } } } if (n > 1) pf.push_back({ n, 1 }); Debug(pf); while (k > 0) { bool pfcond = false; if (pf.size() > 2) pfcond = true; for (auto [p, e] : pf) if (p != 2 && p != 3) pfcond = true; if (!pfcond) break; --k; map new_pf; for (auto [p, e] : pf) { ll new_p = p + 1; for (int i = 2; i * i <= new_p; i++) { while (new_p % i == 0) { new_p /= i; new_pf[i] += e; } } if (new_p != 1) { new_pf[new_p] += e; } } pf.clear(); for (auto [p, e] : new_pf) { pf.push_back({ p, e }); } Debug(k, pf); } mint ans = 1; for (auto [p, e] : pf) { if (p == 2) { ans *= mint(k % 2 == 1 ? 3 : 2).pow((e * mint(2).pow(k / 2)).val()); } else if (p == 3) { ans *= mint(k % 2 == 0 ? 3 : 4).pow((e * mint(2).pow(k / 2)).val()); } else { ans *= mint(p).pow(e.val()); } } return ans.val(); } int solve_greedy(ll n, ll k) { if (k == 0) return n; vector> pf(0); for (int i = 2; i * i <= n; ++i) { if (n % i == 0) { pf.push_back({ i, 0 }); while (n % i == 0) { n /= i; pf.back().second++; } } } if (n > 1) pf.push_back({ n, 1 }); ll res = 1; for (auto [p, e] : pf) { rep(_, e) res *= p + 1; } return solve_greedy(res, k - 1); } int main() { ll n, k; cin >> n >> k; // cout << ans.val() << endl; // for (int n = 2; n < 100; n++) { // for (int k = 1; k < 5; k++) { // int ans = solve(n, k); // int ans_greedy = solve_greedy(n, k); // if (ans != ans_greedy) { // Debug(n, k, ans, ans_greedy); // return 0; // } // } // } cout << solve(n, k) << endl; return 0; }