ll n,m,x,a[2d5],b[2d5],c,d; { rd(n,m,x,a(n),b(m)); c^=a[0..n-1]; c^=b[0..m-1]; if(c)wt(0); else wt(Mint(2)**((n-1)*(m-1)*x)); }