from heapq import heappop,heappush from collections import Counter H,W=map(int,input().split()) x,y=map(int,input().split()) z,w=map(int,input().split()) LIST=[(0,1),(0,-1),(1,0),(-1,0)] Q=[[(((x,y),),x,y),1]] DP=Counter() DP[(((x,y),),x,y)]=1 while Q: #print(Q[-1]) X,count=heappop(Q) S,x,y=X #print(S,x,y) if DP[S,x,y]!=count: continue for px,py in LIST: if 1<=x+px<=H and 1<=y+py<=W: if (x+px,y+py) in S: continue S2=list(S) for px2,py2 in LIST: S2.append((x+px2,y+py2)) X=(tuple(sorted(S2)),x+px,y+py) DP[X]+=count heappush(Q,(X,DP[X])) ANS=0 for X,x,y in DP: if x==z and y==w: ANS+=DP[X,x,y] print(ANS)