We have a large square grid with H rows and W columns.
Iroha is now standing in the top-left cell.
She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.
However, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there are A×B forbidden cells.) There is no restriction on entering the other cells.
Find the number of ways she can travel to the bottom-right cell.
Since this number can be extremely large, print the number modulo 10^9+7.

-----Constraints-----
 -  1 ≦ H, W ≦ 100,000
 -  1 ≦ A < H
 -  1 ≦ B < W

-----Input-----
The input is given from Standard Input in the following format:
H W A B

-----Output-----
Print the number of ways she can travel to the bottom-right cell, modulo 10^9+7.

-----Sample Input-----
2 3 1 1

-----Sample Output-----
2

We have a 2×3 grid, but entering the bottom-left cell is forbidden. The number of ways to travel is two: "Right, Right, Down" and "Right, Down, Right".

Difficulty: MEDIUM_HARD

Solutions:
(h, w, a, b) = map(int, input().split())
n = 2 * 10 ** 5
k = 2 * 10 ** 5
mod = 10 ** 9 + 7
modinv_table = [-1] * (k + 1)
modinv_table[1] = 1
for i in range(2, k + 1):
	modinv_table[i] = -modinv_table[mod % i] * (mod // i) % mod

def prepare_binomial_coefficients(n, k):
	for i in range(1, n + 1):
		bc_num[i] = i * bc_num[i - 1] % mod
	bc_num[0] = 0
	for i in range(1, k + 1):
		bc_den[i] = modinv_table[i] * bc_den[i - 1] % mod
	return

def binomial_coefficients(n, k):
	if n == 0 and k == 0:
		return 1
	return bc_num[n] * bc_den[k] * bc_den[n - k] % mod
bc_num = [1] * (n + 1)
bc_den = [1] * (n + 1)
prepare_binomial_coefficients(n, n)
mids = [0] * (w - b)
dis_mid = h - a - 1
for i in range(w - b):
	mids[i] = binomial_coefficients(dis_mid + i + b, i + b)
mids_down = [0] * (w - b)
dis_mid = a
for i in range(w - b):
	mids_down[i] = binomial_coefficients(dis_mid + w - b - i - 1, w - b - i - 1)
for i in range(w - b - 1):
	mids_down[i] -= mids_down[i + 1]
for i in range(w - b):
	mids[i] = mids[i] * mids_down[i] % mod
print(sum(mids) % mod)


class Factorial:

	def __init__(self, n, mod=10 ** 9 + 7):
		self.fac = [0] * (n + 1)
		self.ifac = [0] * (n + 1)
		self.fac[0] = 1
		self.ifac[0] = 1
		self.mod = mod
		modmod = self.mod - 2
		for i in range(n):
			self.fac[i + 1] = self.fac[i] * (i + 1) % self.mod
			self.ifac[i + 1] = self.ifac[i] * pow(i + 1, modmod, self.mod) % self.mod

	def comb(self, n, r):
		if n == 0 and r == 0:
			return 1
		if n < r or n < 0:
			return 0
		tmp = self.ifac[n - r] * self.ifac[r] % self.mod
		return tmp * self.fac[n] % self.mod

	def perm(self, n, r):
		if n == 0 and r == 0:
			return 1
		if n < r or n < 0:
			return 0
		return self.fac[n] * self.ifac[n - r] % self.mod
(h, w, a, b) = list(map(int, input().split()))
mod = 10 ** 9 + 7
fact = Factorial(h + w + 1)
ans = 0
(c, d) = (h - a, w - b)
for i in range(b + 1, w + 1):
	d = w - i + 1
	ans = (ans + fact.comb(i + c - 2, c - 1) * fact.comb(a + d - 2, a - 1)) % mod
print(ans)


(H, W, A, B) = map(int, input().split())
mod = int(1000000000.0) + 7

def inved(a):
	(x, y, u, v, k, l) = (1, 0, 0, 1, a, mod)
	while l != 0:
		(x, y, u, v) = (u, v, x - u * (k // l), y - v * (k // l))
		(k, l) = (l, k % l)
	return x % mod
fact = [1 for _ in range(H + W + A + B + 1)]
invf = [1 for _ in range(H + W + A + B + 1)]
for i in range(H + W + A + B):
	fact[i + 1] = fact[i] * (i + 1) % mod
invf[-1] = inved(fact[-1])
for i in range(H + W + A + B, 0, -1):
	invf[i - 1] = invf[i] * i % mod
S = 0
for i in range(H - A):
	S += fact[i + B - 1] * invf[i] * fact[H - i + W - B - 2] * invf[H - 1 - i] % mod
	S %= mod
S *= invf[B - 1] * invf[W - B - 1] % mod
S %= mod
print(S)


MOD = 10 ** 9 + 7
UPPERLIMIT = 2 * 10 ** 5 + 1
MODMUL = [1, 1] + [0] * (UPPERLIMIT - 1)
for i in range(2, UPPERLIMIT + 1):
	MODMUL[i] = MODMUL[i - 1] * i % MOD
MODDIV = [1] * UPPERLIMIT + [pow(MODMUL[-1], MOD - 2, MOD)]
for i in range(UPPERLIMIT, 0, -1):
	MODDIV[i - 1] = MODDIV[i] * i % MOD
(H, W, A, B) = map(int, input().split())
ans = MODMUL[H + W - 2] * MODDIV[H - 1] % MOD * MODDIV[W - 1] % MOD
x = [MODMUL[H - A + B + i - 1] * MODDIV[B - 1] * MODDIV[H - A + i] % MOD for i in range(A)]
y = [MODMUL[W + A - B - i - 1] * MODDIV[W - B] * MODDIV[A - i - 1] % MOD for i in range(A)]
for i in range(A - 1, 0, -1):
	x[i] -= x[i - 1]
for i in range(A):
	ans -= x[i] * y[i] % MOD
	ans %= MOD
print(ans)


import math
import time
DIV_VALUE = 10 ** 9 + 7

def calcModOfPow(a, n, p):
	btm = a
	ans = 1
	while n != 0:
		if n & 1:
			ans = ans * btm % p
		n = n >> 1
		btm = btm ** 2 % p
	return ans

def calcModOfInv(a, p):
	b = p
	x = 1
	y = 0
	while b:
		div = a // b
		a -= div * b
		[a, b] = [b, a]
		x -= div * y
		[x, y] = [y, x]
	x %= p
	if x < 0:
		x += p
	return x

class FirstHalf:

	def __init__(self, H, W, A, B):
		self.H = H
		self.W = W
		self.A = A
		self.B = B
		self.k = 0
		self.div = 0
		self.sup = 0
		self.numOfCases = 1

	def getNumOfCases(self):
		if self.k != 0:
			self.numOfCases = self.numOfCases * (self.B + self.k - 1) * calcModOfInv(self.k, DIV_VALUE) % DIV_VALUE
		self.k += 1
		return self.numOfCases

class SecondHalf:

	def __init__(self, H, W, A, B):
		self.H = H
		self.W = W
		self.A = A
		self.B = B
		self.k = 0
		self.div = 0
		self.numOfCases = 1
		totalval = self.H + self.W - self.B - 2
		loopval = self.H - 1 if self.H < self.W - self.B else self.W - self.B - 1
		for top in range(totalval, totalval - loopval, -1):
			self.numOfCases *= top
			self.numOfCases %= DIV_VALUE
		for bottom in range(loopval, 0, -1):
			self.numOfCases *= calcModOfInv(bottom, DIV_VALUE)
			self.numOfCases %= DIV_VALUE

	def getNumOfCases(self):
		if self.k != 0:
			self.numOfCases = self.numOfCases * (self.H - self.k) * calcModOfInv(self.H + self.W - self.B - self.k - 1, DIV_VALUE) % DIV_VALUE
		self.k += 1
		return self.numOfCases

def __starting_point():
	[H, W, A, B] = [int(ipt) for ipt in input().split()]
	start = time.time()
	fstHlf = FirstHalf(H, W, A, B)
	sndHlf = SecondHalf(H, W, A, B)
	totalCases = 0
	mid = time.time()
	for _ in range(H - A):
		totalCases += fstHlf.getNumOfCases() * sndHlf.getNumOfCases()
		totalCases %= DIV_VALUE
	end = time.time()
	print(totalCases)
__starting_point()


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

class CmbMod:

	def __init__(self, n, p):
		self.n = n
		self.p = p
		self.fact = [1, 1]
		self.factinv = [1, 1]
		self.inv = [0, 1]

	def cmb_mod(self, n, r):
		(numer, denom) = (1, 1)
		for i in range(r):
			numer = numer * (n - i) % self.p
			denom = denom * (i + 1) % self.p
		return numer * pow(denom, self.p - 2, self.p) % self.p

	def prep(self):
		for i in range(2, self.n + 1):
			self.fact.append(self.fact[-1] * i % self.p)
			self.inv.append(-self.inv[self.p % i] * (self.p // i) % self.p)
			self.factinv.append(self.factinv[-1] * self.inv[-1] % self.p)

	def cmb_mod_with_prep(self, n, r):
		if r < 0 or n < r:
			return 0
		r = min(r, n - r)
		return self.fact[n] * self.factinv[r] * self.factinv[n - r] % self.p

def resolve():
	(H, W, A, B) = list(map(int, input().split()))
	H -= 1
	W -= 1
	cmb = CmbMod(H + W, mod)
	cmb.prep()
	total = cmb.cmb_mod_with_prep(H + W, H)
	for w in range(B):
		tmp = cmb.cmb_mod_with_prep(H - A + w, w) * cmb.cmb_mod_with_prep(A - 1 + W - w, A - 1) % mod
		total -= tmp
		total %= mod
	print(total)

def __starting_point():
	resolve()
__starting_point()


def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
mod = 10 ** 9 + 7
size = 2 * 10 ** 5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, size + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
(H, W, A, B) = map(int, input().split())
ans = 0
for i in range(W - B):
	ans += cmb(H - A - 1 + (B + i), B + i, mod) * cmb(A - 1 + W - B - 1 - i, A - 1, mod)
	ans %= mod
print(ans)


class Combination:

	def __init__(self, N, MOD=10 ** 9 + 7):
		self.MOD = MOD
		(self.fact, self.inv) = self._make_factorial_list(N)

	def __call__(self, n, k):
		if k < 0 or k > n:
			return 0
		res = self.fact[n] * self.inv[k] % self.MOD
		res = res * self.inv[n - k] % self.MOD
		return res

	def _make_factorial_list(self, N):
		fact = [1] * (N + 1)
		inv = [1] * (N + 1)
		MOD = self.MOD
		for i in range(1, N + 1):
			fact[i] = fact[i - 1] * i % MOD
		inv[N] = pow(fact[N], MOD - 2, MOD)
		for i in range(N, 0, -1):
			inv[i - 1] = inv[i] * i % MOD
		return (fact, inv)

def __starting_point():
	(H, W, A, B) = list(map(int, input().split()))
	mod = 10 ** 9 + 7
	comb = Combination(2 * 10 ** 5 + 10, mod)
	ans = 0
	x = H - A
	y = B + 1
	while x > 0 and y <= W:
		path1 = comb(x + y - 2, x - 1)
		path2 = comb(H - x + W - y, H - x)
		ans = (ans + path1 * path2) % mod
		x -= 1
		y += 1
	print(ans)
__starting_point()


(H, W, A, B) = list(map(int, input().split()))

def mod(num):
	return num % (10 ** 9 + 7)
n = H + W + 1
fac = [0] * n
rev = [0] * n
fac[0] = 1
for i in range(1, n):
	fac[i] = mod(fac[i - 1] * i)
rev[n - 1] = pow(fac[n - 1], 10 ** 9 + 5, 10 ** 9 + 7)
for i in range(n - 2, 0, -1):
	rev[i] = mod(rev[i + 1] * (i + 1))
rev[0] = 1
t1 = [0] * (W - B)
for i in range(W - B):
	t1[i] = mod(fac[H - A - 1 + i + B] * mod(rev[B + i] * rev[H - A - 1]))
res = 0
for i in range(W - B):
	r = t1[i] * mod(fac[A - 1 + W - B - 1 - i] * mod(rev[A - 1] * rev[W - B - 1 - i]))
	res = mod(res + r)
print(res)


M = 10 ** 9 + 7
(H, W, A, B) = map(int, input().split())
C = 1
ans = 1
for I in range(H - 1):
	ans = C = C * (W + H - B - 2 - I) * pow(I + 1, M - 2, M) % M
for I in range(1, H - A):
	C = C * (B - 1 + I) * (H - I) * pow(I * (W + H - B - 1 - I), M - 2, M) % M
	ans += C
print(ans % M)


(H, W, A, B) = list(map(int, input().split()))
C = H - A
D = W - B
p = 1000000007

def power(a, b):
	if b == 0:
		return 1
	elif b % 2 == 0:
		return power(a, b // 2) ** 2 % p
	else:
		return power(a, b // 2) ** 2 * a % p
f = [1]
for i in range(H + W):
	f.append(f[i] * (i + 1) % p)
I_f = [0] * (H + W + 1)
I_f[H + W] = power(f[H + W], p - 2)
for i in reversed(list(range(H + W))):
	I_f[i] = I_f[i + 1] * (i + 1) % p

def combi(a, b):
	return f[a + b] * I_f[a] * I_f[b] % p
x = 0
for i in range(C):
	x = (x + combi(i, B - 1) * combi(D - 1, H - i - 1)) % p
print(x)


from sys import stdin
input = stdin.readline
MAX = 510000
MOD = 10 ** 9 + 7

def MakeTable():
	(fac[0], fac[1]) = (1, 1)
	(finv[0], finv[1]) = (1, 1)
	inv[1] = 1
	for i in range(2, MAX):
		fac[i] = fac[i - 1] * i % MOD
		inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
		finv[i] = finv[i - 1] * inv[i] % MOD

def COM(n, k):
	if n < k:
		return 0
	elif n < 0 or k < 0:
		return 0
	else:
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
(H, W, A, B) = map(int, input().split())
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
N = min(H - A, W - B)
(x, y) = (0, 0)
result = 0
MakeTable()
for _ in range(N):
	n1 = H - A - 1 + B + x - y
	n2 = A + W - 1 - B - x + y
	result += COM(n1, B + x) * COM(n2, A + y) % MOD
	x += 1
	y += 1
print(result % MOD)


(H, W, A, B) = map(int, open(0).read().split())
MOD = 10 ** 9 + 7

def modcomb(m, n, mod):
	if n > m - n:
		n = m - n
	p = 1
	q = 1
	for i in range(n):
		p = p * (m - i) % mod
		q = q * (i + 1) % mod
	result = p * pow(q, mod - 2, mod) % mod
	return result
total = modcomb(H + W - 2, W - 1, MOD)
tmp = modcomb(A + W - 2, W - 1, MOD)
total -= tmp
for i in range(B - 1):
	a = H - A + i
	b = i + 1
	c = W - i - 1
	d = W + A - 2 - i
	tmp = tmp * a * c % MOD
	tmp = tmp * pow(b, -1, MOD) % MOD
	tmp = tmp * pow(d, -1, MOD) % MOD
	total = (total - tmp) % MOD
print(total)


def prepare(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)
(h, w, a, b) = list(map(int, input().split()))
MOD = 10 ** 9 + 7
(facts, invs) = prepare(h + w, MOD)
ans = 0
ib = invs[b - 1]
iwb = invs[w - b - 1]
for down in range(h - a):
	left_pattern = facts[b - 1 + down] * ib * invs[down] % MOD
	right_pattern = facts[h - 1 - down + w - b - 1] * invs[h - 1 - down] * iwb % MOD
	ans = (ans + left_pattern * right_pattern) % MOD
print(ans)


mod = 10 ** 9 + 7
fact = [1]
inv = [1]
for i in range(200000):
	fact.append(fact[i] * (i + 1) % mod)
	inv.append(pow(fact[i + 1], mod - 2, mod))

def ncr(n, r):
	if n < 0 or r < 0 or n - r < 0:
		return 0
	return fact[n] * inv[r] * inv[n - r] % mod
(h, w, a, b) = list(map(int, input().split()))
ans = ncr(h + w - 2, h - 1)
for i in range(min(a, b)):
	ans -= ncr(h - a + b - 1, h - a + i) * ncr(w - b + a - 1, w - b + i)
print(ans % mod)


(h, w, a, b) = list(map(int, input().split()))
fac = [0] * 200001
inv = [0] * 200001
fac[0] = 1
ans = 0
for i in range(1, 200001):
	fac[i] = fac[i - 1] * i % 1000000007
inv[200000] = pow(fac[200000], 1000000005, 1000000007)
for i in range(199999, 0, -1):
	inv[i] = inv[i + 1] * (i + 1) % 1000000007
	inv[0] = 1
for i in range(h - a):
	if i == 0:
		if h == 1:
			x = 1
		else:
			x = fac[w - b + h - 2 - i] * inv[w - 1 - b] * inv[h - 1 - i] % 1000000007
	else:
		x = fac[b - 1 + i] * inv[b - 1] * inv[i] % 1000000007 * (fac[w - b + h - 2 - i] * inv[w - b - 1] * inv[h - 1 - i] % 1000000007)
	ans = (ans + x) % 1000000007
print(ans)


class CombinationFermat:

	def __init__(self):
		MOD = 10 ** 9 + 7
		MAX = 2 * 10 ** 5
		self.fac = [0] * MAX
		self.finv = [0] * MAX
		self.inv = [0] * MAX
		self.fac[0] = self.fac[1] = 1
		self.finv[0] = self.finv[1] = 1
		self.inv[1] = 1
		for i in range(2, MAX):
			self.fac[i] = self.fac[i - 1] * i % MOD
			self.inv[i] = MOD - self.inv[MOD % i] * (MOD // i) % MOD
			self.finv[i] = self.finv[i - 1] * self.inv[i] % MOD

	def comb(self, n: int, r: int) -> int:
		MOD = 10 ** 9 + 7
		if n < r:
			return 0
		if n < 0 or r < 0:
			return 0
		return self.fac[n] * (self.finv[r] * self.finv[n - r] % MOD) % MOD
(H, W, A, B) = list(map(int, input().split()))
c = CombinationFermat()
ans = 0
MOD = 10 ** 9 + 7
for i in range(H - A):
	x = c.comb(B - 1 + i, i)
	a = H - 1 - i
	b = W - 1 - B
	x *= c.comb(a + b, a)
	x %= MOD
	ans += x
ans %= MOD
print(ans)


mod = 10 ** 9 + 7
(h, w, a, b) = map(int, input().split())
fact = [1] * (h + w + 1)
invf = [1] * (h + w + 1)
invn = [1] * (h + w + 1)
for i in range(2, h + w + 1):
	fact[i] = fact[i - 1] * i % mod
	invn[i] = -invn[mod % i] * (mod // i) % mod
	invf[i] = invf[i - 1] * invn[i] % mod
count = 0
for i in range(min(h - a, w - b)):
	count += fact[h + b - a - 1] * invf[h - a - i - 1] * invf[b + i] * fact[w + a - b - 1] * invf[a + i] * invf[w - b - i - 1]
	count %= mod
print(count)


def permutation(n, k, mod):
	s = 1
	for _ in range(k):
		s *= n
		s %= mod
		n -= 1
	return s

def factorial(n, mod):
	s = 1
	for i in range(1, n + 1):
		s *= i
		s %= mod
	return s
(h, w, a, b) = map(int, input().split())
mod = pow(10, 9) + 7
x = h - a + b - 1
y = w - b + a - 2
p = permutation(x, h - a - 1, mod) * permutation(y, a - 1, mod) % mod
ans = p
for _ in range(w - b - 1):
	x += 1
	p = p * x * (y - (a - 1)) * pow((x - (h - a - 1)) * y, mod - 2, mod) % mod
	y -= 1
	ans += p
	ans %= mod
ans = ans * pow(factorial(a - 1, mod), mod - 2, mod) * pow(factorial(h - a - 1, mod), mod - 2, mod) % mod
print(ans)


(h, w, a, b) = map(int, input().split())
mod = pow(10, 9) + 7

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, 200000 + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
ans = 0
for k in range(1, h - a + 1):
	tmp = cmb(k - 1 + b - 1, k - 1, mod)
	tmp *= cmb(h - k + w - b - 1, h - k, mod)
	ans += tmp
	ans %= mod
print(ans)


(h, w, a, b) = list(map(int, input().split()))
MOD = 1000000007

def modPow(a, x, p):
	res = 1
	while x > 0:
		if x % 2 != 0:
			res = res * a % p
		a = a * a % p
		x /= 2
	return res
fact = [None] * 220000
for i in range(1, 220000):
	fact[0] = 1
	fact[i] = i * fact[i - 1] % MOD

def ncr(n, r):
	den = fact[n - r] * fact[r] % MOD
	return fact[n] * pow(den, MOD - 2, MOD) % MOD

def number_of_paths(h, w):
	n = h + w - 2
	r = h - 1
	return ncr(n, r)
ans = 0
for i in range(b + 1, w + 1):
	ans += number_of_paths(h - a, i) * number_of_paths(a, w - i + 1)
print(int(ans % MOD))


class Combination:

	def __init__(self, N: int, P: int):
		self.N = N
		self.P = P
		self.fact = [1, 1]
		self.factinv = [1, 1]
		self.inv = [0, 1]
		for i in range(2, N + 1):
			self.fact.append(self.fact[-1] * i % P)
			self.inv.append(-self.inv[P % i] * (P // i) % P)
			self.factinv.append(self.factinv[-1] * self.inv[-1] % P)

	def getComb(self, n: int, k: int):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		return self.fact[n] * self.factinv[k] * self.factinv[n - k] % self.P

def main():
	(H, W, A, B) = map(int, input().split())
	MOD = 10 ** 9 + 7
	COMB = Combination(H + W, MOD)
	ans = 0
	for i in range(1, H - A + 1):
		tmp = COMB.getComb(i - 1 + (B - 1), i - 1)
		tmp *= COMB.getComb(H - i + (W - B - 1), H - i)
		ans = (ans + tmp) % MOD
	print(ans)

def __starting_point():
	main()
__starting_point()