#include #include #include #include #include using mint=atcoder::modint998244353; using namespace std; using ll=long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int h,w; cin>>h>>w; vector> graph(h*w,vector(h*w)); for(int i=0;i(1<<(h*w)))); for(int i=0;i>l&1)==0)dp[i][l][j+(1<> mat(h*w,vector(h*w)); for(int i=0;i>sx>>sy>>gx>>gy>>k; sx--;sy--;gx--;gy--; ll kq=k/(h*w),kr=k%(h*w); vector> res(h*w,vector(h*w)); for(int i=0;i0){ if(kq&1){ vector> nres(h*w,vector(h*w)); for(int i=0;i> nmat(h*w,vector(h*w)); for(int i=0;i>=1; } mint ans=0; int s=sx*w+sy,g=gx*w+gy; for(int i=0;i