#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 (k % 2 == 1) 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; if (k == 0) { for (auto [p, e] : pf) { ans *= mint(p).pow(e.val()); } } else { assert(k % 2 == 0); for (auto [p, e] : pf) { if (p == 2) { ans *= mint(2).pow((e * mint(2).pow(k / 2)).val()); } else if (p == 3) { ans *= mint(3).pow((e * mint(2).pow(k / 2)).val()); } else { assert(false); } } } return ans.val(); } int main() { ll n, k; cin >> n >> k; // cout << ans.val() << endl; // for (int n = 2; n < 10000; n++) { // for (int k = 1; k < 50000; k++) { // int ans = solve(n, k); // int ans_greedy = solve_greedy(n, k); // if (ans_greedy == -1) { // Debug(n, k, "OVERFLOW"); // break; // } // if (ans != ans_greedy) { // Debug(n, k, ans, ans_greedy); // return 0; // } // } // } cout << solve(n, k) << endl; return 0; }