mod = 998244353 N, M = map(int, input().split()) print(((pow(M, N, mod) - pow(-1, N, mod)) * pow(M + 1, -1, mod) - 1) % mod)