N = int(input())
n = N
i = int(input())
if n <=2:
N = 3 * N + 1
else:
N = 3 * N + 1 for i in range(1, n): N = int(N * 3 / 2) + 1
print(N)