#ifdef _WIN32 # define LL "%I64d" #else # define LL "%Ld" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define null NULL #define mp make_pair #define pb(a) push_back(a) #define sz(a) ((int)(a).size()) #define all(a) a.begin() , a.end() #define fi first #define se second #define relaxMin(a , b) (a) = min((a),(b)) #define relaxMax(a , b) (a) = max((a),(b)) #define SQR(a) ((a)*(a)) typedef vector vi; typedef pair pii; typedef long long ll; #define INF 1000000000000000LL int N , M , A , B; int Sx , Sy , Ex , Ey; char T[510][510]; int sft[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; bool is_in(int x , int y){ return x>=0 && x=0 && y U; ll djikstra(){ for(int i=0;i nval){ U.erase( mp(nx , ny) ); sp[nx][ny] = nval; U.insert( mp(nx , ny) ); } } } return sp[Ex][Ey]; // not get here } int main(){ freopen("exam.in" , "r" , stdin); freopen("exam.out" , "w" , stdout); scanf("%d%d%d%d" , &N , &M , &A , &B); for(int i=0;i