#include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int ans=0, H, W, sx, sy, gx, gy; cin >> H >> W; cin >> sx >> sy; cin >> gx >> gy; sx--; sy--; gx--; gy--; int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; auto f=[&](int h, int w){ return 0 <= h && h < H && 0 <= w && w < W; }; vector used(H, vector(W)); auto dfs=[&](auto self, int i, int j)->void{ if (i == gx && j == gy){ ans++; return; } used[i][j] = 1; int ni, nj, ni2, nj2; for (int k=0; k<4; k++){ ni = i+dx[k]; nj = j+dy[k]; if (!f(ni, nj)) continue; if (used[ni][nj]) continue; bool ok=1; for (int l=0; l<4; l++){ ni2 = ni+dx[l]; nj2 = nj+dy[l]; if (!f(ni2, nj2)) continue; if (ni2 == i && nj2 == j) continue; if (used[ni2][nj2]) ok=0; } if (ok) self(self, ni, nj); } used[i][j] = 0; }; dfs(dfs, sx, sy); cout << ans << endl; return 0; }