#!/usr/bin/env python3 import sys input = sys.stdin.readline import heapq INF = 10**9 class Dijkstra: def __init__(self, adj): self.adj = adj self.dist = [INF] * len(adj) self.q = [] def reset(self): self.dist = [INF] * len(self.adj) self.q = [] def calc(self, start): self.dist[start] = 0 heapq.heappush(self.q, (0, start)) while len(self.q) != 0: prov_cost, src = heapq.heappop(self.q) if self.dist[src] < prov_cost: continue for dest, cost in self.adj[src]: if self.dist[dest] > self.dist[src] + cost: self.dist[dest] = self.dist[src] + cost heapq.heappush(self.q, (self.dist[dest], dest)) return self.dist n, v, ox, oy = map(int, input().split()) ox -= 1; oy -= 1 edge = [[] for _ in range(n * n)] field = [] for _ in range(n): field.append([int(item) for item in input().split()]) delta = [(0, 1), (1, 0), (0, -1), (-1, 0)] for i in range(n): for j in range(n): for dx, dy in delta: if i + dx < 0 or i + dx >= n: continue if j + dy < 0 or j + dy >= n: continue frm = i * n + j too = (i + dx) * n + (j + dy) edge[frm].append((too, field[i + dx][j + dy])) DIJK = Dijkstra(edge) dist_from_start = DIJK.calc(0) ans = v - dist_from_start[n*n-1] - field[0][0] if ox != -1 and oy != -1: DIJK.reset() dist_from_oasis = DIJK.calc(ox*n + oy) ret = v - dist_from_start[ox * n + oy] - field[0][0] ret *= 2 ret -= dist_from_oasis[n*n - 1] ans = max(ans, ret) if ans > 0: print("YES") else: print("NO")