K=-1 a=0 while K: i,j,v=map(int,input().split()) if K<0:H,W,K=i,j,v else: l,r,K=i-j,i+j-W-1,K-1 a+=(i*i-((l>0)*(l+1)*l+(r>0)*(r+1)*r)//2)*v print(a%998244353)