input: Write a python function to calculate the sum of every nth element of an array.
  assert sum_nth([4, 5, 2, 9, 8, 6, 2, 3, 7, 1], 3) == 18
  assert sum_nth([1, 2, 3, 4, 5, 6], 2) == 9
  assert sum_nth([10, 20, 30, 40, 50], 1) == 150
output: def sum_nth(arr, n):
      return sum(arr[i] for i in range(n-1, len(arr), n))