from collections import deque H, W = map(int, input().split()) sh, sw = map(int, input().split()) gh, gw = map(int, input().split()) sh, sw, gh, gw = sh-1, sw-1, gh-1, gw-1 def judge(): que = deque() que.append((gh, gw)) dist = [[-1]*W for _ in range(H)] dist[gh][gw] = visited[gh][gw] while que: h, w = que.popleft() if [h, w] == [sh, sw]: return True for dh, dw in direction: nh, nw = h+dh, w+dw if not (0<=nh visited[nh][nw]: return False if visited[nh][nw] != -1 and dist[nh][nw] == -1: dist[nh][nw] = dist[h][w]-1 que.append((nh, nw)) def dfs(h, w, cnt): visited[h][w] = cnt cnt += 1 if [h, w] == [gh, gw]: if judge(): global ans ans += 1 visited[h][w] = -1 return for dh, dw in direction: nh, nw = h+dh, w+dw if 0<=nh