#include using namespace std; typedef long long int ll; typedef vector vl; typedef pair PP; #define rep(i, n) for(ll i = 0; i < ll(n); i++) template void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } } #define all(v) v.begin(), v.end() #define inputv(v, n) \ vl v; \ rep(i, n) { \ ll x; \ cin >> x; \ v.push_back(x); \ } const ll INF = 999999999999999; const ll MOD = 1000000007; const ll MAX_N = 500010; ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans; struct edge { ll to, cost; }; struct Gragh { ll N; vector> G; vl visited; Gragh(ll n) { N = n; G.resize(N); resetv(); } void add(ll a, ll b, ll c = 1) { G[a].push_back((edge) { b, c }); } void resetv(void) { visited = vl(N, 0); } vl Dijkstra(ll r) { vl cost(N, INF); resetv(); priority_queue, greater> pq; ll a, b = r; cost[b] = 0; visited[b] = 1; for (edge i : G[b]) { if (cost[b] + i.cost < cost[i.to]) { pq.push(make_pair(cost[b] + i.cost, i.to)); } } while (!pq.empty()) { a = pq.top().first; b = pq.top().second; pq.pop(); if (visited[b] == 1)continue; visited[b] = 1; cost[b] = a; for (edge i : G[b]) { if (cost[b] + i.cost < cost[i.to]) { pq.push(make_pair(cost[b] + i.cost, i.to)); } } } return cost; } }; int main() { cin >> n; cin >> h >> x >> y; Gragh G(n*n); x--; y--; ll A[n][n]; rep(i, n) { rep(j, n) { cin >> k; A[i][j] = k; } } rep(i, n) { rep(j, n) { if (i > 0)G.add(i * n + j, (i - 1) * n + j, A[i - 1][j]); if (i < n - 1)G.add(i * n + j, (i + 1) * n + j, A[i + 1][j]); if (j > 0)G.add(i * n + j, i * n + j - 1, A[i][j - 1]); if (j < n - 1)G.add(i * n + j, i * n + j + 1, A[i][j + 1]); } } vl B = G.Dijkstra(0); if (x > -1){ vl C = G.Dijkstra(x * n + y); ans = max(h - B[n * n - 1], (h - B[x * n + y]) * 2 - C[n * n - 1]); } else ans = h - B[n * n - 1]; if (ans > 0)cout << "YES" << endl; else cout << "NO" << endl; }