#include using namespace std; using ll = long long; using PII = std::pair; using PLL = std::pair; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) vector> desert, vital; void dfs(int y, int x, int v, int n) { if (!(0 <= y && y < n && 0 <= x && x < n)) return; if (v - desert[y][x] <= vital[y][x]) return; else { vital[y][x] = v - desert[y][x]; dfs(y, x + 1, v - desert[y][x], n); dfs(y, x - 1, v - desert[y][x], n); dfs(y + 1, x, v - desert[y][x], n); dfs(y - 1, x, v - desert[y][x], n); } } int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif int n, v, ox, oy, di; cin >> n >> v >> ox >> oy; vector vi; rep(i, n) { vi.clear(); rep(j, n) { cin >> di; vi.push_back(di); } desert.push_back(vi); vi.clear(); rep(j, n) { vi.push_back(0); } vital.push_back(vi); } dfs(0, 0, v, n); if (!(ox == 0 && oy == 0)) { oy--, ox--; v = 2 * vital[oy][ox] + desert[oy][ox]; rep(i, n) rep(j, n) vital[i][j] = 0; dfs(oy, ox, v, n); } if (vital[n - 1][n - 1] == 0) cout << "NO" << endl; else cout << "YES" << endl; return 0; }