import java.math.BigInteger; import java.util.*; class pair implements Comparable{ int x; int y; int cost; pair(int x,int y,int cost){ this.x=x; this.y=y; this.cost=cost; } @Override public int compareTo(Object o) { // TODO Auto-generated method stub pair aaa=(pair)o; return this.cost-aaa.cost; } } public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] vx ={1,0,-1,0}; int[] vy= {0,1,0,-1}; int n=sc.nextInt(); int hp=sc.nextInt(); int ox=sc.nextInt(); int oy=sc.nextInt(); int[][] edge = new int[n+1][n+1]; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ edge[i][j]=sc.nextInt(); } } PriorityQueue queue = new PriorityQueue(); int[][] dp = new int[n+1][n+1]; for(int i=1;i<=n;i++){ Arrays.fill(dp[i], Integer.MAX_VALUE); } dp[1][1]=0; queue.add(new pair(1,1,0)); while(!queue.isEmpty()){ pair temp =queue.poll(); if(dp[temp.x][temp.y]n||temp.y+vy[i]<1||temp.y+vy[i]>n) continue; int costt = edge[temp.x+vx[i]][temp.y+vy[i]]; if(dp[temp.x+vx[i]][temp.y+vy[i]]>dp[temp.x][temp.y]+costt){ dp[temp.x+vx[i]][temp.y+vy[i]]=dp[temp.x][temp.y]+costt; queue.add(new pair(temp.x+vx[i],temp.y+vy[i],dp[temp.x+vx[i]][temp.y+vy[i]])); } } } if(ox!=0&&oy!=0){ int[][] dpp = new int[n+1][n+1]; for(int i=1;i<=n;i++){ Arrays.fill(dpp[i], Integer.MAX_VALUE); } dpp[ox][oy]=0; queue.add(new pair(ox,oy,0)); while(!queue.isEmpty()){ pair temp =queue.poll(); if(dpp[temp.x][temp.y]n||temp.y+vy[i]<1||temp.y+vy[i]>n) continue; int costt = edge[temp.x+vx[i]][temp.y+vy[i]]; if(dpp[temp.x+vx[i]][temp.y+vy[i]]>dpp[temp.x][temp.y]+costt){ dpp[temp.x+vx[i]][temp.y+vy[i]]=dpp[temp.x][temp.y]+costt; queue.add(new pair(temp.x+vx[i],temp.y+vy[i],dpp[temp.x+vx[i]][temp.y+vy[i]])); } } } if(dp[n][n]dpp[n][n]){ System.out.println("YES"); return; } System.out.println("NO"); } } else{ if(dp[n][n]