#include using namespace std; using ll =long long; struct mint{ static constexpr int m = 998244353; int x; mint() : x(0){} mint(ll x_):x(x_%m){if(x<0)x+=m;} mint &operator+=(mint b){if((x+=b.x)>=m)x-=m; return *this;} mint &operator-=(mint b){if((x-=b.x)<0)x+=m; return *this;} mint &operator*=(mint b){x=ll(x)*b.x%m; return *this;} mint pow(ll e) const { mint r = 1,b =*this; while(e){ if(e&1) r*=b; b*=b; e>>=1; } return r; } mint inv(){return pow(m-2);} mint &operator/=(mint b){return *this*=b.pow(m-2);} friend mint operator+(mint a,mint b){return a+=b;} friend mint operator-(mint a,mint b){return a-=b;} friend mint operator/(mint a,mint b){return a/=b;} friend mint operator*(mint a,mint b){return a*=b;} }; int main(){ ll H,W; cin>>H>>W; mint h=H,w=W; auto f=[&](ll a) -> mint { return mint(a+a/2)*mint(a-a/2-1)/2; }; cout<<((w*w*f(H)+h*h*f(W))*2-f(H)*f(W)*4).x<<"\n"; }