#include #include #include #include #include using namespace std; using lint = long long; template struct ModInt { #if __cplusplus >= 201402L #define MDCONST constexpr #else #define MDCONST #endif using lint = long long; MDCONST static int mod() { return md; } int val_; int val() const noexcept { return val_; } MDCONST ModInt() : val_(0) {} MDCONST ModInt &_setval(lint v) { return val_ = (v >= md ? v - md : v), *this; } MDCONST ModInt(lint v) { _setval(v % md + md); } MDCONST explicit operator bool() const { return val_ != 0; } MDCONST ModInt operator+(const ModInt &x) const { return ModInt()._setval((lint)val_ + x.val_); } MDCONST ModInt operator-(const ModInt &x) const { return ModInt()._setval((lint)val_ - x.val_ + md); } MDCONST ModInt operator*(const ModInt &x) const { return ModInt()._setval((lint)val_ * x.val_ % md); } MDCONST ModInt operator/(const ModInt &x) const { return ModInt()._setval((lint)val_ * x.inv().val() % md); } MDCONST ModInt operator-() const { return ModInt()._setval(md - val_); } MDCONST ModInt &operator+=(const ModInt &x) { return *this = *this + x; } MDCONST ModInt &operator-=(const ModInt &x) { return *this = *this - x; } MDCONST ModInt &operator*=(const ModInt &x) { return *this = *this * x; } MDCONST ModInt &operator/=(const ModInt &x) { return *this = *this / x; } friend MDCONST ModInt operator+(lint a, const ModInt &x) { return ModInt()._setval(a % md + x.val_); } friend MDCONST ModInt operator-(lint a, const ModInt &x) { return ModInt()._setval(a % md - x.val_ + md); } friend MDCONST ModInt operator*(lint a, const ModInt &x) { return ModInt()._setval(a % md * x.val_ % md); } friend MDCONST ModInt operator/(lint a, const ModInt &x) { return ModInt()._setval(a % md * x.inv().val() % md); } MDCONST bool operator==(const ModInt &x) const { return val_ == x.val_; } MDCONST bool operator!=(const ModInt &x) const { return val_ != x.val_; } MDCONST bool operator<(const ModInt &x) const { return val_ < x.val_; } // To use std::map friend std::istream &operator>>(std::istream &is, ModInt &x) { lint t; return is >> t, x = ModInt(t), is; } MDCONST friend std::ostream &operator<<(std::ostream &os, const ModInt &x) { return os << x.val_; } MDCONST ModInt pow(lint n) const { ModInt ans = 1, tmp = *this; while (n) { if (n & 1) ans *= tmp; tmp *= tmp, n >>= 1; } return ans; } static std::vector facs, facinvs, invs; MDCONST static void _precalculation(int N) { int l0 = facs.size(); if (N > md) N = md; if (N <= l0) return; facs.resize(N), facinvs.resize(N), invs.resize(N); for (int i = l0; i < N; i++) facs[i] = facs[i - 1] * i; facinvs[N - 1] = facs.back().pow(md - 2); for (int i = N - 2; i >= l0; i--) facinvs[i] = facinvs[i + 1] * (i + 1); for (int i = N - 1; i >= l0; i--) invs[i] = facinvs[i] * facs[i - 1]; } MDCONST ModInt inv() const { if (this->val_ < std::min(md >> 1, 1 << 21)) { if (facs.empty()) facs = {1}, facinvs = {1}, invs = {0}; while (this->val_ >= int(facs.size())) _precalculation(facs.size() * 2); return invs[this->val_]; } else { return this->pow(md - 2); } } MDCONST ModInt fac() const { while (this->val_ >= int(facs.size())) _precalculation(facs.size() * 2); return facs[this->val_]; } MDCONST ModInt facinv() const { while (this->val_ >= int(facs.size())) _precalculation(facs.size() * 2); return facinvs[this->val_]; } }; template std::vector> ModInt::facs = {1}; template std::vector> ModInt::facinvs = {1}; template std::vector> ModInt::invs = {0}; using mint = ModInt<1000000007>; using mint2 = ModInt<1000000006>; struct Sieve { std::vector min_factor; std::vector primes; Sieve(int MAXN) : min_factor(MAXN + 1) { for (int d = 2; d <= MAXN; d++) { if (!min_factor[d]) { min_factor[d] = d; primes.emplace_back(d); } for (const auto &p : primes) { if (p > min_factor[d] or d * p > MAXN) break; min_factor[d * p] = p; } } } }; Sieve sieve((1 << 20)); int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N; lint K; cin >> N >> K; map mp; while (N > 1) mp[sieve.min_factor.at(N)] += 1, N /= sieve.min_factor.at(N); while (K) { if (mp.size() <= 2 and prev(mp.end())->first <= 3 and K % 2 == 0) break; --K; const map mpold = mp; mp.clear(); for (auto [p, d] : mpold) { int q = p + 1; while (q > 1) { mp[sieve.min_factor.at(q)] += d; q /= sieve.min_factor.at(q); } } } const auto c = mint2(2).pow(K / 2); mint ret = 1; for (auto [p, d] : mp) ret *= mint(p).pow((d * c).val()); cout << ret << '\n'; }