N = int(input()) DIV = 10 ** 9 + 7 dp = [0] * 4 dp[0] = 1 for _ in range(N): new_dp = [0] * 4 for i in range(4): for j in range(4): if i == j: continue new_dp[j] += dp[i] new_dp[j] %= DIV dp = new_dp print(dp[0])