N = int(input()) mod = 10 ** 9 + 7 print(((4 * pow(10, N%(mod-1), mod) - 1) * pow(3, mod-2, mod)) % mod)