#include using namespace std; int dp[200][200][2]; int main(){ cin.tie(nullptr)->sync_with_stdio(false); int N, V, Ox, Oy; cin >> N >> V >> Ox >> Oy; --Ox, --Oy; vector L(N, vector(N, 0)); for(int i = 0; i < N; ++i){ for(int j = 0; j < N; ++j){ cin >> L[i][j]; } } queue> que; que.emplace(0, 0, 1, V); dp[0][0][1] = V; const int dirs[] = {0, 1, 0, -1, 0}; while(!que.empty()){ auto [y, x, has, vital] = que.front(); que.pop(); if(dp[y][x][has] > vital) continue; for(int k = 0; k < 4; ++k){ int y2 = y + dirs[k + 1]; int x2 = x + dirs[k]; if(x2 < 0 || x2 >= N || y2 < 0 || y2 >= N) continue; if(vital <= L[y2][x2]) continue; int vital2 = vital - L[y2][x2]; int has2 = has; if(has2 && y2 == Oy && x2 == Ox){ vital2 *= 2; has2 = 0; } if(vital2 > dp[y2][x2][has2]){ dp[y2][x2][has2] = vital2; que.emplace(y2, x2, has2, vital2); } } } if(dp[N - 1][N - 1][0] || dp[N - 1][N - 1][1]){ cout << "YES"; } else{ cout << "NO"; } cout << endl; return 0; }