Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

def power(a, b, p): #a^b (mod p)を求める #二分累乗法を使う
    if b == 0:
        return 1
    elif b % 2 == 0:
        return power(a, b//2, p) ** 2 % p
    else:
        return power(a, b//2, p) ** 2 * a % p

H, W, A, B = map(int, input().split())
C = H - A
D = W - B
p = 1000000007
b = power(factorial(B-1), p-2, p)
d = power(factorial(D-1), p-2, p)

x = 0
for i in range(C):
    k = factorial(i+B-1) % p
    l = factorial(D+H-i-2) % p
    x += (k * l * b * d * power(factorial(i), p-2, p) * power(factorial(H-i-1), p-2, p)) % p
print(x % p)


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

def power(a, b): #a^b (mod p)を求める #二分累乗法を使う
    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] #f[i] = i! % p
for i in range(H+W):
    f.append(f[i] * (i+1) % p)

I_f = [0] * (H+W+1) #I_f[i] = (i!)^(-1) % p
I_f[H+W] = power(f[H+W], p-2)
for i in reversed(range(H+W)):
    I_f[i] = I_f[i+1] * (i+1) % p

def combi(a, b): #(a+b)!/a!b! (mod p)を求める
    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)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

def power(a, b, p): #a^b (mod p)を求める #二分累乗法を使う
    if b == 0:
        return 1
    elif b % 2 == 0:
        x = power(a, b//2, p)
        return x ** 2 % p
    elif b % 2 == 1:
        y = power(a, b-1, p)
        return a * y % p

H, W, A, B = map(int, input().split())
C = H - A
D = W - B
p = 1000000007
b = power(factorial(B-1), p-2, p)
d = power(factorial(D-1), p-2, p)

x = 0
for i in range(C):
    k = factorial(i+B-1) % p
    l = factorial(D+H-i-2) % p
    x += (k * l * b * d * power(factorial(i), p-2, p) * power(factorial(H-i-1), p-2, p)) % p
print(x % p)


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

def power(a, b): #a^b (mod p)を求める #二分累乗法を使う
    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] #f[i] = i! % p
for i in range(H+W):
    f.append(f[i] * (i+1) % p)

I_f = [0] * (H+W+1) #I_f[i] = (i!)^(-1) % p
I_f[H+W] = power(f[H+W], p-2)
for i in reversed(range(H+W)):
    I_f[i] = I_f[i+1] * (i+1) % p

def combi(a, b): #(a+b)!/a!b! (mod p)を求める
    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)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

def power(a, b, p): #a^b (mod p)を求める #二分累乗法を使う
    if b == 0:
        return 1
    elif b % 2 == 0:
        x = power(a, b//2, p)
        return x ** 2 % p
    elif b % 2 == 1:
        y = power(a, b-1, p)
        return a * y % p

H, W, A, B = map(int, input().split())
C = H - A
D = W - B
p = 1000000007
b = power(factorial(B-1), p-2, p)
d = power(factorial(D-1), p-2, p)

x = 0
for i in range(C):
    k = factorial(i+B-1) % p
    l = factorial(D+H-i-2) % p
    x += k * l * b * d * power(factorial(i), p-2, p) * power(factorial(H-i-1), p-2, p)
print(x % p)


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

def power(a, b): #a^b (mod p)を求める #二分累乗法を使う
    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] #f[i] = i! % p
for i in range(H+W):
    f.append(f[i] * (i+1) % p)

I_f = [0] * (H+W+1) #I_f[i] = (i!)^(-1) % p
I_f[H+W] = power(f[H+W], p-2)
for i in reversed(range(H+W)):
    I_f[i] = I_f[i+1] * (i+1) % p

def combi(a, b): #(a+b)!/a!b! (mod p)を求める
    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)

Buggy python submission (verdict: Time Limit Exceeded):
def power(a, b, p): #a^b (mod p)を求める #二分累乗法を使う
    if b == 0:
        return 1
    elif b % 2 == 0:
        x = power(a, b//2, p)
        return x ** 2 % p
    elif b % 2 == 1:
        y = power(a, b-1, p)
        return a * y % p

def comb(a, b, p): #(a+b)!/a!b! (mod p)を求める #power関数を使う
    from math import factorial
    if a<0 or b<0:
        return 0
    if a==0 or b==0:
        return 1
    A = factorial(a)
    B = factorial(b)
    AB = factorial(a+b)
    return (AB * power(A,p-2,p) * power(B,p-2,p)) % p

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

x = 0
for i in range(C):
    x += (comb(i, B-1, p) * comb(D-1, H-i-1, p)) % p
print(x % p)


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

def power(a, b): #a^b (mod p)を求める #二分累乗法を使う
    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] #f[i] = i! % p
for i in range(H+W):
    f.append(f[i] * (i+1) % p)

I_f = [0] * (H+W+1) #I_f[i] = (i!)^(-1) % p
I_f[H+W] = power(f[H+W], p-2)
for i in reversed(range(H+W)):
    I_f[i] = I_f[i+1] * (i+1) % p

def combi(a, b): #(a+b)!/a!b! (mod p)を求める
    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)