Buggy python submission (verdict: Time Limit Exceeded):

import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]

for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
def c(a,b):
    return M[a+b-2]*power(M[a-1],e-2)*power(M[b-1],e-2)%e

T = 0
for i in range(B+1,W+1):
    P = c(H-A,i)
    Q = c(A,W-i+1)
    T = (T + P*Q)
print(T%e)

Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Time Limit Exceeded):
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
N = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
    b = power(M[i],e-2)
    N.append(b)
def c(a,b):
    return M[a+b-2]*N[a-1]*N[b-1]%e

T = 0
for i in range(B+1,W+1):
    P = c(H-A,i)
    Q = c(A,W-i+1)
    T = (T + P*Q)
print(T%e)


Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Time Limit Exceeded):
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
N = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
    b = power(M[i],e-2)
    N.append(b)
def c(a,b):
    return M[a+b-2]*N[a-1]*N[b-1]%e

T = 0
for i in range(B+1,W+1):
    P = c(H-A,i)
    Q = c(A,W-i+1)
    T = (T + P*Q)
print(T%e)


Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Time Limit Exceeded):
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N = []
for i in range(H+W):
    b = power(M[i],e-2)
    N.append(b)
def c(a,b):
    return M[a+b-2]*N[a-1]*N[b-1]%e

T = 0
for i in range(B+1,W+1):
    P = c(H-A,i)
    Q = c(A,W-i+1)
    T = (T + P*Q)
print(T%e)

Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Time Limit Exceeded):
import math
H, W, A, B = map(int,input().split())
def f(a,b):
    p = math.factorial(a+b-2)
    q = math.factorial(a-1)
    r = math.factorial(b-1)
    S = p // (q*r)
    return S
T = 0
for i in range(1,B+1):
    P = f(H-A,i)
    Q = f(A,W-i+1)
    T = T + P*Q
R = f(H,W) - T
ans = R % (10**9+7)
print(ans)

Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Time Limit Exceeded):
import math
H, W, A, B = map(int,input().split())
def f(a,b):
    p = math.factorial(a+b-2)
    q = math.factorial(a-1)
    r = math.factorial(b-1)
    S = p // (q*r)
    return S
T = 0
for i in range(1,B+1):
    P = f(H-A,i)
    Q = f(A,W-i+1)
    T = T + P*Q
R = f(H,W) - T
ans = R % (10**9+7)
print(ans)

Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)

Buggy python submission (verdict: Runtime Error):
import math
H, W, A, B = map(int,input().split())
def f(a,b):
    p = math.factorial(a+b-2)
    q = math.factorial(a-1)
    r = math.factorial(b-1)
    S = p // (q*r)
return S
T = 0
for i in range(1,H-A):
    P = f(i,B+1)
    Q = f(H-i+1,W-B)
    T = T + P*Q
print(T)

Fixed submission:
import math
H, W, A, B = map(int,input().split())
e = 10**9 + 7
def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a % e
    elif b%2 == 0:
        return power(a,b//2)**2 % e
    else:
        return power(a,b//2)**2*a % e
    
M = [1]
for i in range(1,H+W):
    a = M[i-1]*i%e
    M.append(a)
N= [0]*(H+W)
N[H+W-1] = power(M[H+W-1], e-2)
for i in range(H+W-2, -1, -1):
    N[i] = N[i+1] * (i+1) % e

def c(a,b):
    return M[a]*N[b]*N[a-b]%e

T = 0
for i in range(W-B):
    P = c(H+W-A-i-2,H-A-1)
    Q = c(A+i-1,i)
    T = (T + P*Q)
print(T%e)