Загрузка данных
n = int(input()) mod = 1000000007 if n == 1: print(3) elif n == 2: print(9) else: ans = (9 * pow(2, n - 2, mod)) % mod print(ans)