input: Write a python function to calculate the sum of the product of n and the sum of i and i+1, divided by 2 for all i from 0 to n-1.
  assert function(3) == 9
  assert function(4) == 24
  assert function(5) == 50
output: def function(n):
      total = 0
      for i in range(n):
          total += n * (i + (i + 1)) / 2
      return total