#include #include #define ll long long using namespace std; using namespace atcoder; using mint = modint998244353; vector facts(1, 1); vector invFacts(1, 1); mint comb(int n, int r) { return facts[n] * invFacts[r] * invFacts[n-r]; } int main() { ll H, W; cin >> H >> W; if (H == 1 || W == 1) { cout << 1 << endl; return 0; } for (int i = 1; i <= max(H-2, W-1); i++) { facts.push_back(i * facts[i-1]); invFacts.push_back(1 / facts[i]); } mint ans = 0; for (int i = 0; i < min(2*H-2, 2*W-1); i++) { int x = i / 2; int y = (i+1) / 2; mint pow = mint(2).pow((H-1)*(W-1) - i); ans += pow * comb(H-2, x) * comb(W-1, y); } cout << ans.val() << endl; }