input: Write a function to calculate the sum of terms in a geometric progression.
  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 * (r**n - 1) // (r - 1)