S = 10 ** 9 + 7

def mpow(n, p, mod)
  r = 1
  while p > 0
    r = r * n % mod if p % 2 == 1
    n = n * n % mod
    p >>= 1
  end
  r
end

N = gets.to_i
# 8

if N == 1 then
  puts 0
elsif N == 2 then
  puts 2
else
  c = 0
  n = N * (N - 1) % S
  (2..N).each do |i|
    tp = mpow(8, N - i, S)
    c += n * tp
    c %= S

    n *= (2 * (N - i)) % S
    n %= S
  end
  puts c
end
