Python Hard
```
class Solution:
    def distanceSum(self, m: int, n: int, k: int) -> int:
        '''
        need to subtract double counting
        '''
        M, N = m, n
        MOD = 10**9 + 7

        # idea: we can seperate xs and ys
        
        # distance sum between any two points along x (n**2) means cols ** 2
        # picking two cols n * n ways
        # second part is sum of all two xs abs diff is (m - 1) * m * (m + 1)
        # d1 = (n**2) * ((m-1) * (m) * (m + 1)) // 3
        d1 = 0
        # left_sum = 0
        right_sum = 0
        for i in range(m):
            right_sum += i
        for i in range(m):
            d1 += right_sum
            right_sum -= m - (i + 1)

        d1 *= n ** 2

        # distance sum between any two points along y (m**2) means rows ** 2
        # picking two rows m * m ways
        # second part is sum of all two ys abs diff is (n - 1) * n * (n + 1)
        # d2 = (m**2) * ((n-1) * (n) * (n + 1)) // 3
        d2 = 0
        # left_sum = 0
        right_sum = 0
        for i in range(n):
            right_sum += i
        for i in range(n):
            d2 += right_sum
            right_sum -= n - (i + 1)
        d2 *= m ** 2


        d = d1 + d2

        # removing double counting
        # d //= 2

        # given two points are placed, we place rest of points
        d *= math.comb(M*N-2, k-2)

        d %= MOD
        return d

        

        
```
['Python3']