### constant

MOD = 100000007

### subroutines

def distnum(n, c1, c2)
  if c1 > c2
    t = c1; c1 = c2; c2 = t
  end
  dc0 = c2 - c1
  dc1 = n - c2 + c1
  [(dc0 < dc1) ? dc0 : dc1, (dc0 == dc1) ? 2 : 1]
end

def mulmod(a, b)
  (a * b) % MOD
end

def powmod(a, n)
  pm = 1
  while n > 0
    pm = mulmod(pm, a) if (n & 1) == 1
    a = mulmod(a, a)
    n >>= 1
  end
  pm
end

def invmod(a)
  powmod(a, MOD - 2)
end

### main

r, c, a1, a2, b1, b2 = gets.split.map(&:to_i)

da, na = distnum(r, a1, b1)
db, nb = distnum(c, a2, b2)
#p [da, na, db, nb]

dab = da + db

fracs = [1]
invfs = [1]

for k in (1..dab)
  fracs[k] = (fracs[k - 1] * k) % MOD
  invfs[k] = invmod(fracs[k])
end

comb = mulmod(mulmod(fracs[dab], invfs[da]), invfs[db])
comb = mulmod(mulmod(comb, na), nb)

puts comb