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[][] d1,int[][] map,int n){ while(!que.isEmpty()){ pair now = que.poll(); if ( d1[now.row][now.column]=0 && now.row+dr[i]=0 && now.column+dc[i]d1[now.row][now.column]+map[now.row+dr[i]][now.column+dc[i]]){ d1[now.row+dr[i]][now.column+dc[i]]=d1[now.row][now.column]+map[now.row+dr[i]][now.column+dc[i]]; que.add(new pair(d1[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 or = sc.nextInt()-1; int oc = 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; PriorityQueue que1 = new PriorityQueue<>(); que1.add(new pair(0,or,oc)); dijkstra(que1, d2, map, n); }else{ if(d1[n-1][n-1]