input: Write a python function that calculates the total of a geometric sequence.
  assert sum_gp(1,5,2)==31
  assert sum_gp(1,5,4)==341
  assert sum_gp(2,6,3)==728
output: def sum_gp(a, n, r):
      return a * (1 - r ** n) // (1 - r) if r != 1 else a * n