import heapq N, V, Ox, Oy = map(int, input().split()) Ox -= 1 Oy -= 1 L = [[int(j) for j in input().split()] for i in range(N)] already = [[False for i in range(N)] for j in range(N)] already[0][0] = True queue = [] heapq.heappush(queue, (L[0][0], 0, 0)) course = [(0, 1), (1, 0), (-1, 0), (0, -1)] s = 0 while queue: tmp = heapq.heappop(queue) for i in course: y, x = tmp[1] + i[0], tmp[2] + i[1] if x < 0 or y < 0 or x >= N or y >= N: continue if already[y][x]: continue if (v := tmp[0] + L[y][x]) >= V: continue already[y][x] = True heapq.heappush(queue, (v, y, x)) if y == Oy and x == Ox: s = v if already[N - 1][N - 1]: print('YES') exit() if (Ox == -1 and Oy == -1) or not already[Oy][Ox]: print('NO') exit() already = [[False for i in range(N)] for j in range(N)] s -= V - s heapq.heappush(queue, (s, Oy, Ox)) while queue: tmp = heapq.heappop(queue) print(tmp) for i in course: y, x = tmp[1] + i[0], tmp[2] + i[1] if x < 0 or y < 0 or x >= N or y >= N: continue if already[y][x]: continue if (v := tmp[0] + L[y][x]) >= V: continue already[y][x] = True heapq.heappush(queue, (v, y, x)) if already[N - 1][N - 1]: print('YES') else: print('NO')