from heapq import heappop,heappush I=lambda:map(int,raw_input().split()) N,V,x,y=I();s=(0,0);o=(x-1,y-1);g=(N-1,N-1) L=[I()for i in range(N)];dxy=((1,0),(0,1),(-1,0),(0,-1)) def d(s,g): Q=[];D=[N*[100000]for i in range(N)] D[s[1]][s[0]]=0 heappush(Q,(0,s)) while Q: c,h=heappop(Q) if h == g:break for dx,dy in dxy: nx=h[0]+dx;ny=h[1]+dy if 0<=nxd(s,g)or(o!=(-1,-1) and(V-d(s,o))*2>d(o,g))]