parseInt() = parse.(Int64, readline()::String |> split)::Vector{Int64} parseInt2() = parse.(Int64, readline()::String |> collect)::Vector{Int64} parseInt3() = parse(Int64, readline()::String)::Int64 module Modulo mod = 998244353 export Mint, pow mutable struct Mint m::Int64 Mint(x) = x ≥ 0 ? new(x % mod) : new((mod - (-x) % mod) % mod) end function Base.:+(x::Mint, y::Mint) return Mint(+(x.m, y.m)) end function Base.:-(x::Mint, y::Mint) return Mint(-(x.m, y.m)) end function Base.:*(x::Mint, y::Mint) return Mint(*(x.m, y.m)) end function inverse(x::Mint) a = x.m b = mod u = 1 v = 0 while b > 0 t = a ÷ b a -= t * b a, b = b, a u -= t * v u, v = v, u end return Mint(u) end function Base.:/(x::Mint, y::Mint) return x * inverse(y) end function pow(x::Mint, n::Int64) ret = Mint(1) while n > 0 if n & 1 != 0 ret *= x end x *= x n >>= 1 end return ret end end using .Modulo function main() n, p = parseInt() k = p num = 0 while n ÷ k > 0 num += n ÷ k k *= p end pow(Mint(p), num).m |> println end main()