h,w=map(int,input().split());s,t=[int(x)-1 for x in input().split()];g,k=[int(x)-1 for x in input().split()]
F=[[0]*w for _ in[0]*h];ans=[0];d=((0,1),(0,-1),(1,0),(-1,0))
def f(x,y):
    if (x,y)==(g,k):ans[0]+=1;return
    F[x][y]=1
    for i,j in d:
        nx,ny=x+i,y+j
        if 0<=nx<h and 0<=ny<w and not F[nx][ny] and sum(0<=nx+ii<h and 0<=ny+jj<w and F[nx+ii][ny+jj] for ii,jj in d)==1:
            f(nx,ny)
    F[x][y]=0
f(s,t);print(ans[0])