R=range H,W,K,M=map(int,input().split()) HW=H*W p=1<>5) count=[0]*(HW+1) dfs=[] for h in R(H): for w in R(W): i=h*W+w s=1<>5]|=1<<(s&31) bs=0 for dx,dy in zip([-1,0,1,0],[0,-1,0,1]): if 0<=h+dx>i)&1<1:continue h,w=i//W,i%W t=s|(1<>5]>>(t&31))&1:continue; found[t>>5]|=1<<(t&31) bt=bs^(1<>j)&1<1:bt|=(1<