#!/usr/bin/python2 # -*- coding: utf-8 -*- # † mod = 10**9 + 7 def mod_inv(a, m): b, s, t, old_a = m, 1, 0, a while b: q = a / b a %= b a, b = b, a s -= t * q s, t = t, s if a != 1: return None return s + m if s < 0 else s # \frac{10^{n} - 1}{3} + 10^{n} def f(n): inv = mod_inv(3, mod) p10 = pow(10, n, mod) res = (p10 - 1) * inv + p10 # res = (p10 - 1) / 3 + p10 # わざと 3 で割ってみる res %= mod return res ## N = int(raw_input()) res = f(N) print res