H, W = map(int, input().split()) Sx, Sy = [i - 1 for i in list(map(int, input().split()))] G = tuple([i - 1 for i in list(map(int, input().split()))]) dir = [[1, 0], [0, 1], [0, -1], [-1, 0]] nv = [[True] * W for _ in range(H)] nv[Sx][Sy] = False ans = 0 def dfs(x, y): global ans if (x, y) == G: ans += 1 return for xd, yd in dir: x1 = x + xd y1 = y + yd if 0 <= x1 < H and 0 <= y1 < W: if nv[x1][y1]: f = True for xa, ya in dir: x2 = x1 + xa y2 = y1 + ya if x2 == x and y2 == y: continue if 0 <= x2 < H and 0 <= y2 < W: if nv[x2][y2] == False: f = False break if f: nv[x1][y1] = False dfs(x1, y1) nv[x1][y1] = True dfs(Sx, Sy) print(ans)