#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout< PI; typedef pair V; const ll mod = 10000000000; int n, v, ox, oy; int l[202][202] = {}; bool used[202][202] = {}; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; struct edge { int to, cost; }; vector G[202][202]; int dijkstra(PI s,PI t,int n) { int dist[202][202] = {}; rep(i,1,n+1)rep(j,1,n+1) {dist[i][j] = -1;} rep(i, 0, n + 2)dist[0][i] = dist[i][0] = dist[n + 1][i] = dist[i][n + 1] = mod; priority_queue, greater>que; que.push(make_pair(0, s)); while (!que.empty()) { PI v = que.top().second; int di = que.top().first; que.pop(); if (dist[v.first][v.second] >= 0)continue; dist[v.first][v.second] = di; rep(i, 0, 4) { PI p = v; p.first += dx[i]; p.second += dy[i]; if (dist[p.first][p.second] >= 0)continue; que.push(make_pair(di + l[p.first][p.second], p)); } } return dist[t.first][t.second]; } int main() { PI o; cin >> n >> v >> o.second >> o.first; rep(i,1,n+1)rep(j,1, n+1) { cin >> l[i][j]; } auto st = make_pair(1, 1); auto ed = make_pair(n, n); if (dijkstra(st, ed, n) < v) { print("YES") } else { int u = (v - dijkstra(st, o, n)) * 2; if ((o.first != 0 || o.second != 0) && u > 0 && u - dijkstra(o, ed, n) > 0) { print("YES"); } else { print("NO"); } } return 0; }