import java.util.*; class pair implements Comparable{ int cost; int row,column; pair(int cost,int row,int column){ this.cost=cost; this.row = row; this.column = column; } @Override public int compareTo(pair o) { // TODO Auto-generated method stub return this.cost-o.cost; } } public class Main { static void dijkstra(PriorityQueue que,int[][] d,int[][] map,int n){ while(!que.isEmpty()){ pair now = que.poll(); if ( d[now.row][now.column]=0 && now.row+dr[i]=0 && now.column+dc[i]d[now.row][now.column]+map[now.row+dr[i]][now.column+dc[i]]){ d[now.row+dr[i]][now.column+dc[i]]=d[now.row][now.column]+map[now.row+dr[i]][now.column+dc[i]]; que.add(new pair(d[now.row+dr[i]][now.column+dc[i]], now.row+dr[i],now.column+dc[i])); } } } } } static int[] dr ={1,0,-1,0}; static int[] dc ={0,1,0,-1}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int v = sc.nextInt(); int oc = sc.nextInt()-1; int or = sc.nextInt()-1; int[][] map = new int[n][n]; for(int i=0;i que = new PriorityQueue<>(); que.add(new pair(0, 0, 0)); dijkstra(que, d1, map, n); if(or!=-1&&oc!=-1){ d2[or][oc]=0; que = new PriorityQueue<>(); que.add(new pair(0,or,oc)); dijkstra(que, d2, map, n); //System.out.println(Arrays.deepToString(d2)); }else{ if(d1[n-1][n-1]