Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,m,K=map(int,input().split())
ans=0
def comb(n,r):
    return factorial(n)//factorial(n-r)//factorial(r)
for i in range(3,n+m+1):
    t=0
    for j in range(max(1,i-n),i):
        if(j>m):
            ans+=t*(i-2)
            break
        k=i-j
        if(j==1 or k==1):
            t+=(m-j+1)*(n-k+1)
        else:
            t+=(m-j+1)*(n-k+1)*2
    else:
        ans+=t*(i-2)
print((ans*comb(n*m-2,K-2))%(10**9+7))

Fixed submission:
n,m,k=map(int,input().split())
mod=10**9+7
x=1
y=1
for i in range(1,k-1):
    y*=i
    y%=mod
for i in range(k-2):
    x*=n*m-2-i
    x%=mod
x*=pow(y,mod-2,mod)
x%=mod
def f(n,m):
    s=0
    for i in range(1,n):
        s+=i*(n-i)
        s%=mod
    return s*m*m%mod
print((f(n,m)+f(m,n))*x%mod)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,m,K=map(int,input().split())
ans=0
def comb(n,r):
    return factorial(n)//factorial(n-r)//factorial(r)
for i in range(3,n+m+1):
    t=0
    for j in range(max(1,i-n),i):
        if(j>m):
            ans+=t*(i-2)
            break
        k=i-j
        if(j==1 or k==1):
            t+=(m-j+1)*(n-k+1)
        else:
            t+=(m-j+1)*(n-k+1)*2
    else:
        ans+=t*(i-2)
print((ans*comb(n*m-2,K-2))%(10**9+7))

Fixed submission:
n,m,k=map(int,input().split())
mod=10**9+7
x=1
y=1
for i in range(1,k-1):
    y*=i
    y%=mod
for i in range(k-2):
    x*=n*m-2-i
    x%=mod
x*=pow(y,mod-2,mod)
x%=mod
def f(n,m):
    s=0
    for i in range(1,n):
        s+=i*(n-i)
        s%=mod
    return s*m*m%mod
print((f(n,m)+f(m,n))*x%mod)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,m,K=map(int,input().split())
ans=0
t=0
def comb(n,r):
    return factorial(n)//factorial(n-r)//factorial(r)
for i in range(3,n+m+1):
    for j in range(max(1,i-n),i):
        if(j>m):
            break
        k=i-j
        if(j==1 or k==1):
            ans+=(i-2)*(m-j+1)*(n-k+1)
        else:
            ans+=(i-2)*(m-j+1)*(n-k+1)*2
print((ans*comb(n*m-2,K-2))%(10**9+7))

Fixed submission:
n,m,k=map(int,input().split())
mod=10**9+7
x=1
y=1
for i in range(1,k-1):
    y*=i
    y%=mod
for i in range(k-2):
    x*=n*m-2-i
    x%=mod
x*=pow(y,mod-2,mod)
x%=mod
def f(n,m):
    s=0
    for i in range(1,n):
        s+=i*(n-i)
        s%=mod
    return s*m*m%mod
print((f(n,m)+f(m,n))*x%mod)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,m,K=map(int,input().split())
ans=0
t=0
def comb(n,r):
    return factorial(n)//factorial(n-r)//factorial(r)
for i in range(3,n+m+1):
    for j in range(1,i):
        if(j>m):
            break
        k=i-j
        if(k<=n):
            if(j==1 or k==1):
                ans+=(i-2)*(m-j+1)*(n-k+1)
            else:
                ans+=(i-2)*(m-j+1)*(n-k+1)*2
print((ans*comb(n*m-2,K-2))%(10**9+7))

Fixed submission:
n,m,k=map(int,input().split())
mod=10**9+7
x=1
y=1
for i in range(1,k-1):
    y*=i
    y%=mod
for i in range(k-2):
    x*=n*m-2-i
    x%=mod
x*=pow(y,mod-2,mod)
x%=mod
def f(n,m):
    s=0
    for i in range(1,n):
        s+=i*(n-i)
        s%=mod
    return s*m*m%mod
print((f(n,m)+f(m,n))*x%mod)