import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) def modinv(a, mod=10 ** 9 + 7): return pow(a, mod - 2, mod) n = int(readline()) mod = 10 ** 9 + 7 print(pow(7, n - 1, mod) * modinv(pow(6, n, mod), mod) % mod)