import collections import sys sys.setrecursionlimit(10**5) H,W = map(int,input().split()) Si,Sj = map(int,input().split()) Gi,Gj = map(int,input().split()) ans = 0 S = set() WW = 100 S.add(Si*WW+Sj) D = collections.deque() D.append([Si,Sj]) X = [1,0,-1,0] Y = [0,1,0,-1] ans = 0 def dfs(): global ans if D[-1]==[Gi,Gj]: ans+=1 else: i,j = D[-1] for x,y in zip(X,Y): ni = i+x nj = j+y if 1<=ni<=H and 1<=nj<=W and not ni*WW+nj in S: S.remove(i*WW+j) if not (ni*WW+nj+1 in S or (ni+1)*WW+nj in S or (ni-1)*WW+nj in S or ni*WW+nj-1 in S): S.add(i*WW+j) D.append([ni,nj]) S.add(ni*WW+nj) dfs() D.pop() S.remove(ni*WW+nj) S.add(i*WW+j) dfs() print(ans)