// github.com/Johniel/contests // yukicoder/2365/main.cpp #include #define each(i, c) for (auto& i : c) #define unless(cond) if (!(cond)) // #define endl "\n" using namespace std; template ostream& operator << (ostream& os, pair p) { os << "(" << p.first << "," << p.second << ")"; return os; } template istream& operator >> (istream& is, pair& p) { is >> p.first >> p.second; return is; } template ostream& operator << (ostream& os, vector v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; } template istream& operator >> (istream& is, vector& v) { for (auto& i: v) is >> i; return is; } template ostream& operator << (ostream& os, set s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; } template ostream& operator << (ostream& os, map m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; } template istream& operator >> (istream& is, array& a) { for (auto& i: a) is >> i; return is; } template ostream& operator << (ostream& os, array& a) { os << "[" << N << "]{"; for (auto& i: a) os << i << ","; os << "}"; return os; } template inline T setmax(T& a, T b) { return a = std::max(a, b); } template inline T setmin(T& a, T b) { return a = std::min(a, b); } __attribute__((constructor)) static void ___initio(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.setf(ios_base::fixed); cout.precision(15); return ; } using lli = long long int; using ull = unsigned long long; using str = string; template using vec = vector; constexpr array di({0, 1, -1, 0, 1, -1, 1, -1}); constexpr array dj({1, 0, 0, -1, 1, -1, -1, 1}); constexpr lli mod = 1e9 + 7; // constexpr lli mod = 998244353; vec> fn(lli x, lli w) { vec> v; for (lli i = 2; i * i <= x; ++i) { if (x % i == 0) { int a = 0; while (x % i == 0) { ++a; x /= i; } v.push_back(make_pair(i, a * w)); } } if (x != 1) v.push_back(make_pair(x, w)); return v; } vec> merge(vec> a, vec> b) { sort(a.begin(), a.end()); sort(b.begin(), b.end()); vec> v; int i = 0; int j = 0; while (i < a.size() && j < b.size()) { if (a[i].first == b[j].first) { v.push_back(make_pair(a[i].first, a[i].second + b[j].second)); ++i; ++j; } else if (a[i].first < b[j].first) { v.push_back(a[i]); ++i; } else { v.push_back(b[j]); ++j; } } while (i < a.size()) v.push_back(a[i++]); while (j < b.size()) v.push_back(b[j++]); return v; } lli mod_pow(lli n, lli p, lli M = mod) { if (p == 0) return 1; if (p == 1) return n % M; lli m = mod_pow(n, p / 2, M); m *= m; m %= M; if (p % 2) m = (m * n) % M; return m; } int main(int argc, char *argv[]) { lli n, k; while (cin >> n >> k) { vec> u = fn(n, 1); // cout << u << endl; while (k--) { vec> v = u; u.clear(); each (i, v) { u = merge(u, fn(i.first + 1, i.second)); } // cout << u << endl; if (u.size() == 1 && u.front().first == 2) break; } if (u.size() == 1 && u.front().first == 2 && k) { lli p = mod_pow(u[0].second, k / 2); // cout << u << ' ' << k << ' ' << p << endl; u[0].second = u[0].second * p; if (k % 2) { u[0].first = 3; } } lli z = 1; each (i, u) { z *= mod_pow(i.first, i.second); z %= mod; } cout << z << endl; } return 0; }