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<=y2<W):continue if not (0<=x2<H):continue if seen[x2][y2]:continue cnt=0 for xx,yy in d: xt=x2+xx yt=y2+yy if not (0<=yt<W):continue if not (0<=xt<H):continue if seen[xt][yt]:cnt +=1 if cnt>1: continue else: dfs(x2,y2) seen[x1][y1] = False dfs(Si-1,Sj-1) print(ans)