import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int v = sc.nextInt(); int ox = sc.nextInt(); int oy = sc.nextInt(); int[][] field = new int[n + 2][n + 2]; Arrays.fill(field[0], 2000); Arrays.fill(field[n + 1], 2000); for (int i = 1; i <= n; i++) { field[i][0] = 2000; field[i][n + 1] = 2000; for (int j = 1; j <= n; j++) { field[i][j] = sc.nextInt(); } } PriorityQueue queue = new PriorityQueue<>(); queue.add(new Path(1, 1, 0)); int[][] costs = new int[n + 2][n + 2]; for (int[] arr : costs) { Arrays.fill(arr, Integer.MAX_VALUE); } while (queue.size() > 0) { Path p = queue.poll(); p.value += field[p.x][p.y]; if (costs[p.x][p.y] <= p.value || v <= p.value) { continue; } costs[p.x][p.y] = p.value; queue.add(new Path(p.x - 1, p.y, p.value)); queue.add(new Path(p.x, p.y - 1, p.value)); queue.add(new Path(p.x + 1, p.y, p.value)); queue.add(new Path(p.x, p.y + 1, p.value)); } if ((costs[n][n] == Integer.MAX_VALUE && ox == 0 && oy == 0) || (ox != 0 && oy != 0 && costs[ox][oy] == Integer.MAX_VALUE)) { System.out.println("NO"); return; } else if (costs[n][n] < v) { System.out.println("YES"); return; } v = (v - costs[ox][oy]) * 2; queue.add(new Path(ox, oy, - field[ox][oy])); for (int[] arr : costs) { Arrays.fill(arr, Integer.MAX_VALUE); } while (queue.size() > 0) { Path p = queue.poll(); p.value += field[p.x][p.y]; if (costs[p.x][p.y] <= p.value || v <= p.value) { continue; } costs[p.x][p.y] = p.value; queue.add(new Path(p.x - 1, p.y, p.value)); queue.add(new Path(p.x, p.y - 1, p.value)); queue.add(new Path(p.x + 1, p.y, p.value)); queue.add(new Path(p.x, p.y + 1, p.value)); } if (costs[n][n] == Integer.MAX_VALUE) { System.out.println("NO"); } else { System.out.println("YES"); } } static class Path implements Comparable { int x; int y; int value; public Path(int x, int y, int value) { this.x = x; this.y = y; this.value = value; } public int compareTo(Path another) { return value - another.value; } } }