#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a,b) memset((a),(b),sizeof(a)) const LL INF = 1e9 + 7; const int N = 1e3 + 10; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); LL n, p; cin >> n >> p; LL mod = 998244353; LL ans = 1; while (n % p == 0) n /= p, ans *= p; ans %= mod; cout << ans << endl; return 0; }