#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(ll i = 0;i < n;i++) #define REPR(i, n) for(ll i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(ll i = 1;i <= n;i++) #define ll long long #define INF (ll)1ll << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(),n.end() #define MOD (ll)1000000007 #define P pair ll H, W, mod = 998244353; ll sum(ll n){ n %= mod; return n * (n + 1) / 2 % mod; } ll solve1(ll x, ll y){ //Σ HW - (A - i)(B - j) ll A, B; A = (H % 2 == 1 ? (H + 3) / 2 : (H + 4) / 2); B = (W % 2 == 1 ? (W + 3) / 2 : (W + 4) / 2); ll res = 0; res += (H * W - A * B) % mod * x % mod * y % mod; res += B * sum(x) % mod * y % mod; res += A * sum(y) % mod * x % mod; res -= sum(x) * sum(y) % mod; res = (res % mod + mod) % mod; return res; } ll solve2(){ if(H % 2 == 1 and W % 2 == 1){ ll ans = 0; REP(i, 2)REP(j, 2) ans += solve1((H + i) / 2, (W + j) / 2); return ans % mod; } if(H % 2 == 0 and W % 2 == 0){ return solve1(H / 2, W / 2) * 4 % mod; } if(H % 2 == 0)swap(H, W); return (2 * solve1((H + 1) / 2, W / 2) + 2 * solve1(H / 2, W / 2)) % mod; } int main(){ cin >> H >> W; cout << solve2() << endl; }