[CODE ONLY][DEBUG OUTPUT] PYTHON USING LEE'S SOLUTION
Using Lee's solutionLINK: https://leetcode.com/problems/manhattan-distances-of-all-arrangements-of-pieces/solutions/6299217/java-c-python-combinations-o-m-nCode
# Using Lee's solution
# LINK: https://leetcode.com/problems/manhattan-distances-of-all-arrangements-of-pieces/solutions/6299217/java-c-python-combinations-o-m-n

# Code
```python3 []
# Using Lee's solution
# LINK: https://leetcode.com/problems/manhattan-distances-of-all-arrangements-of-pieces/solutions/6299217/java-c-python-combinations-o-m-n

class Solution:
    def distanceSum(self, m: int, n: int, k: int) -> int:
        max_mod = 1_000_000_007

        def getManhattanDistancePerDimension(target_dimension:int, orthogonal_dimension: int) -> int:
            """Count all the ways per a target dimension (rows or cols)."""
            # print(f'for the target {target_dimension}, there are up to {orthogonal_dimension} ways to count a distance across.')
            subtotal = 0
            for each_distance in range(1, target_dimension):
                # print(f'\tsubtotal:{subtotal}')
                # print(f'\tat {each_distance}...')
                shrinking_dimension = target_dimension - each_distance
                # print(f'\t\tthe shrinking portion is {target_dimension} - {each_distance} = {shrinking_dimension}')
                shrinking_distance = shrinking_dimension * orthogonal_dimension
                # print(f'\t\t\twhich has a distance of {shrinking_distance}')
                full_distance = each_distance * orthogonal_dimension
                # print(f'\t\t\t\tthe full distance is {each_distance} * {orthogonal_dimension}')
                # print(f'\t\t\t\t....{full_distance}')
                # print(f'\t\t\t\t\tADD {shrinking_distance * full_distance}')
                subtotal += shrinking_distance * full_distance
                subtotal %= max_mod

            return subtotal

        base = math.comb(m * n - 2, k - 2) % max_mod
        # print(f'There are base={base} ways')
        all_the_ways = 0

        rows = n
        cols = m

        # print(f'Looking at n={rows} rows...')
        all_the_ways += getManhattanDistancePerDimension(
            target_dimension = rows,
            orthogonal_dimension = cols
            )
        # print(f'Looking at m=cols cols...')
        all_the_ways += getManhattanDistancePerDimension(
            target_dimension = cols,
            orthogonal_dimension = rows
            )

        # print(f'all the ways are {all_the_ways}...')
        full_count = all_the_ways * base
        # print(f'...multiplied by {base} gives {all_the_ways * base}')
        full_count %= max_mod
        return full_count

# DEBUG OUTPUT
# There are base=1540 ways
# Looking at n=3 rows...
# for the target 3, there are up to 8 ways to count a distance across.
# 	subtotal:0
# 	at 1...
# 		the shrinking portion is 3 - 1 = 2
# 			which has a distance of 16
# 				the full distance is 1 * 8
# 				....8
# 					ADD 128
# 	subtotal:128
# 	at 2...
# 		the shrinking portion is 3 - 2 = 1
# 			which has a distance of 8
# 				the full distance is 2 * 8
# 				....16
# 					ADD 128
# Looking at m=cols cols...
# for the target 8, there are up to 3 ways to count a distance across.
# 	subtotal:0
# 	at 1...
# 		the shrinking portion is 8 - 1 = 7
# 			which has a distance of 21
# 				the full distance is 1 * 3
# 				....3
# 					ADD 63
# 	subtotal:63
# 	at 2...
# 		the shrinking portion is 8 - 2 = 6
# 			which has a distance of 18
# 				the full distance is 2 * 3
# 				....6
# 					ADD 108
# 	subtotal:171
# 	at 3...
# 		the shrinking portion is 8 - 3 = 5
# 			which has a distance of 15
# 				the full distance is 3 * 3
# 				....9
# 					ADD 135
# 	subtotal:306
# 	at 4...
# 		the shrinking portion is 8 - 4 = 4
# 			which has a distance of 12
# 				the full distance is 4 * 3
# 				....12
# 					ADD 144
# 	subtotal:450
# 	at 5...
# 		the shrinking portion is 8 - 5 = 3
# 			which has a distance of 9
# 				the full distance is 5 * 3
# 				....15
# 					ADD 135
# 	subtotal:585
# 	at 6...
# 		the shrinking portion is 8 - 6 = 2
# 			which has a distance of 6
# 				the full distance is 6 * 3
# 				....18
# 					ADD 108
# 	subtotal:693
# 	at 7...
# 		the shrinking portion is 8 - 7 = 1
# 			which has a distance of 3
# 				the full distance is 7 * 3
# 				....21
# 					ADD 63
# all the ways are 1012...
# ...multiplied by 1540 gives 1558480
```
['Python3']