#include #include #include #include const int mod = 998244353; // 素因数分解函数 std::map prime_factorize(int n) { std::map prime_factors; while (n % 2 == 0) { prime_factors[2]++; n /= 2; } int f = 3; while (f * f <= n) { if (n % f == 0) { prime_factors[f]++; n /= f; } else { f += 2; } } if (n != 1) { prime_factors[n]++; } return prime_factors; } // 快速幂函数,用于计算 a^b % mod long long modpow(long long base, int exp, int modulus) { base %= modulus; long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % modulus; base = (base * base) % modulus; exp >>= 1; } return result; } int main() { int N, M; std::cin >> N >> M; auto CP = prime_factorize(M); long long ans = 1; for (auto const& kvp : CP) { int v = kvp.second; ans = ans * (modpow(v + 1, N, mod) - modpow(v, N, mod) + mod) % mod; } std::cout << ans << std::endl; return 0; }