#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 20000000;
const int MOD = 998244353;
int pow_mod(int b, int p) {
	int ret = 1;
	while( p ) {
		if( p & 1 ) ret = 1LL*ret*b%MOD;
		b = 1LL*b*b%MOD;
		p >>= 1;
	}
	return ret;
}
int fct[MAXN + 5], ifct[MAXN + 5];
void init() {
	fct[0] = 1;
	for(int i=1;i<=MAXN;i++)
		fct[i] = 1LL*fct[i-1]*i%MOD;
	ifct[MAXN] = pow_mod(fct[MAXN], MOD-2);
	for(int i=MAXN-1;i>=0;i--)
		ifct[i] = 1LL*ifct[i+1]*(i+1)%MOD;
}
int pw1[MAXN + 5], pw2[MAXN + 5];
int main() {
	init();	int N, M;
	scanf("%d%d", &N, &M);
	int ans = 0;
	pw1[0] = pw2[0] = 1;
	for(int i=1;i<=max(N, M);i++)
		pw1[i] = 1LL*pw1[i-1]*(N+1)%MOD, pw2[i] = 1LL*pw2[i-1]*(M+1)%MOD;
	for(int i=0,f=1;i<=min(N,M);i++,f=1LL*f*(MOD-1)%MOD) {
		int del = 1LL*ifct[N-i]*ifct[M-i]%MOD*ifct[i]%MOD;
		del = 1LL*del*pw1[M-i]%MOD*pw2[N-i]%MOD;
		ans = (ans + 1LL*f*del)%MOD;
	}
	printf("%lld\n", 1LL*ans*fct[N]%MOD*fct[M]%MOD);
}
