input: def exponential_series(x: int, n: int) -> int:
      """ Calculate the sum of the exponential series for a given integer x up to n terms.
      >>> exponential_series(2, 3)
      15
      >>> exponential_series(1, 5)
      6
      """
output:     result = 0
      for i in range(n):
          result += x ** i
      return result