from collections import deque import sys sys.setrecursionlimit(1 << 20) H,W=map(int,input().split()) Si,Sj=map(int,input().split()) Gi,Gj=map(int,input().split()) d=[[1,0],[0,1],[-1,0],[0,-1]] global ans ans=0 seen=[[False for j in range(W)] for i in range(H)] def dfs(x1,y1): global ans seen[x1][y1]=True #print(seen[0]) #print(seen[1]) #print("###") if x1==Gi-1 and y1==Gj-1: ans += 1 seen[x1][y1] = False #print("#") return for x,y in d: x2=x1+x y2=y1+y if not (0<=y21: continue else: dfs(x2,y2) seen[x1][y1] = False dfs(Si-1,Sj-1) print(ans)