Function to return the sum of the costs of all the possible arrangements of the cells
def arrange ( n , m , k ) : NEW_LINE INDENT factorialfun ( ) ; NEW_LINE modinversefun ( ) ; NEW_LINE ans = 0 ; NEW_LINE DEDENT