#include "bits/stdc++.h" using namespace std; int N; int dp[200][200][2]; int L[200][200]; int ok(int a, int b){ return a >= 0 && b >= 0 && a < N && b < N; } int main() { int V, Ox, Oy; cin >> N >> V >> Ox >> Oy; Ox--; Oy--; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cin >> L[i][j]; } } dp[0][0][1] = V; priority_queue> pq; int dy[]{1, 0, -1, 0}; int dx[]{0, 1, 0, -1}; pq.push(make_tuple(V, 0, 0, 1)); while (!pq.empty()){ auto now = pq.top(); pq.pop(); int h = get<0>(now); int y = get<1>(now); int x = get<2>(now); int f = get<3>(now); if (y == N - 1 && x == N - 1){ cout << "YES" << endl; return 0; } if (dp[y][x][f] != h) continue; if (f == 1 && y == Oy && x == Ox){ h *= 2; f = 0; } for (int k = 0; k < 4; k++) { int ny = y + dy[k]; int nx = x + dx[k]; if (!ok(ny, nx)) continue; int nh = h - L[ny][nx]; if (nh <= 0) continue; if (dp[ny][nx][f] < nh){ dp[ny][nx][f] = nh; pq.push(make_tuple(nh, ny, nx, f)); } } } cout << "NO" << endl; }