gx,gy,n,f=map(int,input().split()) c=[list(map(int,input().split()))for _ in[0]*n] gx+=1 gy+=1 d=[[1e99]*gx for _ in[0]*gy] d[0][0]=0 def dp(x,y,u): for i in range(n): if u[i]:continue nx=x+c[i][0] ny=y+c[i][1] if nx