Calculate the sum of the first n terms in the sequence: 1 + 3 + 9 + 27 + 81 + \ldots
A natural number n, where 1 \leq n \leq 39.
A single number representing the sum of the first n terms of the sequence.
Example 1