import sys sys.setrecursionlimit(10**7) dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] def check(px, py): cnt = 0 for k in range(4): x, y = px + dx[k], py + dy[k] if x < 0 or x > H - 1 or y < 0 or y > W - 1: continue cnt += seen[x][y] return cnt def dfs(x, y): global ans if x == gx and y == gy: ans += 1 return for k in range(4): nx, ny = x + dx[k], y + dy[k] if nx < 0 or nx > H - 1 or ny < 0 or ny > W - 1: continue if seen[nx][ny]: continue if check(nx, ny) >= 2: continue seen[nx][ny] = 1 dfs(nx, ny) seen[nx][ny] = 0 return H, W = map(int, input().split()) sx, sy = map(int, input().split()) gx, gy = map(int, input().split()) seen = [[0] * W for _ in range(H)] ans = 0 sx, sy, gx, gy = sx - 1, sy - 1, gx - 1, gy - 1 seen[sx][sy] = 1 dfs(sx, sy) print(ans)