from math import factorial

def comb (x,y):

	return factorial(x)//factorial(x-y)//factorial(y)



w,h,ax,ay,bx,by=list(map(int,input().split()))

dx=abs(ax-bx)

dx=min(dx,w-dx)

dy=abs(ay-by)

dy=min(dy,h-dy)

ans=1

if dx*2==w:ans*=2

if dy*2==h:ans*=2

ans*=comb(dx+dy,dx)

print((ans%100000007))
from math import factorial

def comb (x,y):

	return factorial(x)//factorial(x-y)//factorial(y)



w,h,ax,ay,bx,by=list(map(int,input().split()))

dx=abs(ax-bx)

dx=min(dx,w-dx)

dy=abs(ay-by)

dy=min(dy,h-dy)

an=1

if dx*2==w:an*=2

if dy*2==h:an*=2

an*=comb(dx+dy,dx)

print((an%int(1E8+7)))
from math import factorial


def comb(x, y):
    return factorial(x) // factorial(x - y) // factorial(y)


w, h, ax, ay, bx, by = list(map(int, input().split()))
dx = abs(ax - bx)
dx = min(dx, w - dx)
dy = abs(ay - by)
dy = min(dy, h - dy)
ans = 1
if dx * 2 == w:
    ans *= 2
if dy * 2 == h:
    ans *= 2
ans *= comb(dx + dy, dx)
print((ans % 100000007))

from math import factorial


def comb(x, y):
    return factorial(x) // factorial(x - y) // factorial(y)


w, h, ax, ay, bx, by = list(map(int, input().split()))
dx = abs(ax - bx)
dx = min(dx, w - dx)
dy = abs(ay - by)
dy = min(dy, h - dy)
an = 1
if dx * 2 == w:
    an *= 2
if dy * 2 == h:
    an *= 2
an *= comb(dx + dy, dx)
print((an % int(1e8 + 7)))

-ans = 1 +an = 1 -    ans *= 2 +    an *= 2 -    ans *= 2 -ans *= comb(dx + dy, dx) -print((ans % 100000007)) +    an *= 2 +an *= comb(dx + dy, dx) +print((an % int(1e8 + 7)))