Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    b *= i+1

comb = a//b
ans = ((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)%mod
ans *= comb
print(ans%mod)

Fixed submission:
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    a %= mod
    b *= i+1
    b %= mod
comb = a * pow(b, mod - 2, mod) % mod

ans = (((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)*comb)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())

comb = 1
mod = 10**9+7
for i in range(min(K-2, N*M-K)):
    comb *= (N*M-2-i)
    comb //= i+1

comb %= mod
x = (N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2
y = (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2
ans = (x+y)*comb
print(ans%mod)

Fixed submission:
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    a %= mod
    b *= i+1
    b %= mod
comb = a * pow(b, mod - 2, mod) % mod

ans = (((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)*comb)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())

comb = 1
mod = 10**9+7
for i in range(min(K-2, N*M-K)):
    comb *= (N*M-2-i)
    comb //= i+1

comb %= mod
x = (N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2
y = (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2
ans = (x+y)*comb
print(ans%mod)

Fixed submission:
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    a %= mod
    b *= i+1
    b %= mod
comb = a * pow(b, mod - 2, mod) % mod

ans = (((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)*comb)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())

comb = 1
mod = 10**9+7
for i in range(min(K-2, N*M-K)):
    comb *= (N*M-2-i)
for i in range(min(K-2, N*M-K)):
    comb //= i+1
    
comb %= mod

x = (N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2
y = (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2
ans = (x+y)*comb
print(ans%mod)

Fixed submission:
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    a %= mod
    b *= i+1
    b %= mod
comb = a * pow(b, mod - 2, mod) % mod

ans = (((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)*comb)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())

x = 0
y = 0
comb = 1
mod = 10**9+7
for i in range(min(K-2, N*M-K)):
    comb *= (N*M-2-i)
for i in range(min(K-2, N*M-K)):
    comb //= i+1
    
comb %= mod
for d in range(1, N):
    x += d*(N-d)*M**2
for d in range(1, M):
    y += d*(M-d)*N**2
    
ans = x+y
ans %= mod
    
print((ans*comb)%mod)

Fixed submission:
N,M,K = map(int, input().split())

mod = 10**9+7
a = 1
b = 1
for i in range(min(K-2, N*M-K)):
    a *= (N*M-2-i)
    a %= mod
    b *= i+1
    b %= mod
comb = a * pow(b, mod - 2, mod) % mod

ans = (((N*N*(N+1)//2-N*(N+1)*(2*N+1)//6)*M**2 + (M*M*(M+1)//2-M*(M+1)*(2*M+1)//6)*N**2)*comb)%mod
print(ans)