H, W = map(int, input().split()) Si, Sj = map(int, input().split()) Gi, Gj = map(int, input().split()) Si -= 1 Sj -= 1 Gi -= 1 Gj -= 1 def dfs(c, x, y): if x == Gi and y == Gj: return 1 ans = 0 for nx, ny in [(x - 1, y), (x, y - 1), (x + 1, y), (x, y + 1)]: if 0 <= nx < H and 0 <= ny < W and c & (1 << (nx * W + ny)) == 0: cn = 0 for nnx, nny in [(nx - 1, ny), (nx, ny - 1), (nx + 1, ny), (nx, ny + 1)]: if 0 <= nnx < H and 0 <= nny < W and c & (1 << (nnx * W + nny)): cn += 1 if cn == 1: ans += dfs(c | (1 << (nx * W + ny)), nx, ny) return ans print(dfs(1 << (Si * W + Sj), Si, Sj))