//#include #include using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; const vector dx = {0, 1, 0, -1}; const vector dy = {1, 0, -1, 0}; int Ans = 0; map>,bool> DP; int H,W,S1,S2,G1,G2; void DFS(int I, int J, vector> G) { if(DP[G]) return; DP[G] = true; if(I == G1 && J == G2) { Ans++; return; } for(int i = 0; i < 4; i++) { int ni = I+dx[i]; int nj = J+dy[i]; if(ni <= 0 || H < ni || nj <= 0 || W < nj) continue; G[I][J] = false; if(!G[ni][nj] && !G[ni-1][nj] && !G[ni+1][nj] && !G[ni][nj-1] && !G[ni][nj+1]) { // cout << I << " " << J << " " << ni << " " << nj << endl; G[I][J] = true; G[ni][nj] = true; DFS(ni,nj,G); G[ni][nj] = false; } G[I][J] = true; } G[I][J] = true; return; } int main() { vector> G(8,vector(8)); cin >> H >> W; cin >> S1 >> S2 >> G1 >> G2; G[S1][S2] = true; DFS(S1,S2,G); cout << Ans << endl; return 0; }