#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // https://github.com/shingo0909/kyopro/blob/39029fab39c1735c38e5e9e4494d9934f81d6918/Library/doubling.cpp struct doubling { vector> d; int n; doubling(vector p) : d(60, vector(p.size())) { n = p.size(); d[0] = p; for (int i = 1; i < 60; i++) { for (int j = 0; j < n; j++) { d[i][j] = d[i - 1][d[i - 1][j]]; } } } int get_ans(int x, long long t) { for (int i = 0; i < 60; i++) { if ((t >> i) % 2) { x = d[i][x]; } } return x; } }; // https://github.com/shingo0909/kyopro/blob/39029fab39c1735c38e5e9e4494d9934f81d6918/Library/PrimeTable.cpp struct PrimeTable { private: int n; vector spf; vector primes; void build() { spf[0] = -1; spf[1] = -1; for (int i = 2; i <= n; i++) { if (spf[i] == 0) { spf[i] = i; primes.push_back(i); } for (int p : primes) { if (p > spf[i] || 1LL * p * i > n) break; spf[p * i] = p; } } return; } public: PrimeTable(int n) : n(n), spf(n + 1, 0) { build(); } bool is_prime(int x) const { return x >= 2 && spf[x] == x; } // 素因数分解 vector> factorize(int x) const { vector> res; while (x > 1) { int p = spf[x]; int cnt = 0; while (x % p == 0) { x /= p; cnt++; } res.emplace_back(p, cnt); } return res; } // 約数列挙 // ソートされていないことに注意 vector divisors(int n) const { vector res{1}; auto pf = factorize(n); for (auto p : pf) { int s = (int)res.size(); for (int i = 0; i < s; i++) { int v = 1; for (int j = 0; j < p.second; j++) { v *= p.first; res.push_back(res[i] * v); } } } return res; } }; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n, k; cin >> n >> k; if (k == 1) { cout << n << endl; return 0; } k -= 2; int m = 100003; PrimeTable p(3000010); vector g(m, 0); rep(i, m) { if (i == 0) continue; ll s = 0; for (auto j : p.divisors(i)) s += j; g[i] = s % m; } doubling d(g); ll f = 0; for (auto i : p.divisors(n)) f += i; f %= m; cout << d.get_ans(f, k) << endl; return 0; }