import heapq # Input N, V, OY, OX = map(int, input().split()) L = [ list(map(int, input().split())) for i in range(N) ] OX, OY = OX - 1, OY - 1 # Dijkstra dx = [ 0, 1, 0, -1 ] dy = [ 1, 0, -1, 0 ] dist = [ [ [ 0 ] * N for j in range(N) ] for i in range(2) ] vis = [ [ [ False ] * N for j in range(N) ] for i in range(2) ] que = [ (-V, 0, 0, 0) ] heapq.heapify(que) dist[0][0][0] = V while len(que) >= 1: u = heapq.heappop(que) if vis[u[1]][u[2]][u[3]]: continue vis[u[1]][u[2]][u[3]] = True for i in range(4): tx, ty = u[2] + dx[i], u[3] + dy[i] if 0 <= tx and tx < N and 0 <= ty and ty < N: ncost = -u[0] - L[tx][ty] tc = u[1] if tc == 0 and tx == OX and ty == OY: ncost *= 2 tc = 1 if dist[tc][tx][ty] < ncost: dist[tc][tx][ty] = ncost heapq.heappush(que, (-ncost, tc, tx, ty)) # Output if dist[0][N - 1][N - 1] > 0 or dist[1][N - 1][N - 1] > 0: print("YES") else: print("NO")