N = 2*10**5 mod = 998244353 g1 = [1]*(N+1) # 元テーブル g2 = [1]*(N+1) #逆元テーブル inverse = [1]*(N+1) #逆元テーブル計算用テーブル for i in range( 2, N + 1 ): g1[i]=( ( g1[i-1] * i ) % mod ) inverse[i]=( ( -inverse[mod % i] * (mod//i) ) % mod ) g2[i]=( (g2[i-1] * inverse[i]) % mod ) inverse[0]=0 def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return (g1[n] * g2[r] % mod) * g2[n-r] % mod import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N,M = mi() res = 0 for k in range(1,min(M,N+1)+1): if k==1: res -= cmb(M,k,mod) * pow(M-1,2*N,mod) % mod else: res -= cmb(M,k,mod) * pow(k,k-2,mod) * g1[N] * g2[N-k+1] * pow(2,k-1,mod) * pow(M-k,2*(N-(k-1)),mod) % mod res %= mod res += M * pow(M,2*N,mod) % mod print(res % mod)