#include #include constexpr intmax_t mod = 1e9+7; intmax_t modpow(intmax_t base, intmax_t iexp) { intmax_t res = 1; for (intmax_t dbl = base; iexp; iexp >>= 1) { if (iexp & 1) res = res * dbl % mod; dbl = dbl * dbl % mod; } return res; } intmax_t moddiv(intmax_t n, intmax_t d) { return n * modpow(d, mod-2) % mod; } int main() { intmax_t n; scanf("%jd", &n); // 3, 30, 300, ... intmax_t res = 3 * moddiv((modpow(10, n)+mod-1)%mod, 9); (res += modpow(10, n)) %= mod; printf("%jd\n", res); }