#include #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = std::int64_t; using P = std::tuple; template std::tuple extgcd(T a, T b){ T s1 = 1, t1 = 0, s2 = 0, t2 = 1; while(b != 0){ std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2); std::tie(a, b) = std::make_tuple(b, a % b); } return std::make_tuple(s1, t1, a); } template T mod_expt(T a, std::int64_t n, T mod){ T power {1}; while(n > 0){ if(n & 1){power = power * a % mod;} a = a * a % mod; n >>= 1; } return power; } template T mod_inverse(T a, T mod){ T b; std::tie(b, std::ignore, std::ignore) = extgcd(a, mod); if(b < 0){b += mod;} return b; } ll N; constexpr ll MOD = 1'000'000'007; int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N; ll x = mod_expt(10, N, MOD), y = (x - 1) * mod_inverse(3, MOD) % MOD, z = (x + y) % MOD; std::cout << z << std::endl; }