from heapq import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(): n, v, oj, oi = MI() oi, oj = oi - 1, oj - 1 ll = [LI() for _ in range(n)] dp0 = [[0] * n for _ in range(n)] hp=[] heappush(hp,[-v,0,0]) while hp: p,i,j=heappop(hp) p=-p if p<=dp0[i][j]:continue dp0[i][j]=p if (i,j)==(oi,oj):continue for di,dj in [(1,0),(0,1),(-1,0),(0,-1)]: ni,nj=i+di,j+dj if ni<0 or ni>=n or nj<0 or nj>=n:continue np=p-ll[ni][nj] if np=n or nj<0 or nj>=n:continue np=p-ll[ni][nj] if np