input: Write a function to calculate the result of multiplying all pairs of indices and adding them together, multiplied by (n-1).
  assert my_function(3) == 18
  assert my_function(4) == 72
  assert my_function(5) == 200
output: def my_function(n):
      result = 0
      for i in range(n):
          for j in range(n):
              result += i * j
      return result * (n - 1)