#include #include #include #include #include #include using namespace std; using ll = long long int; #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define ALL_INCLUDED_ENVIRONMENT template std::ostream& operator<<(std::ostream& o, const std::vector& v) { o << "{"; for (int i = 0; i < (int) v.size(); i++) o << (i > 0 ? ", " : "" ) << v[i]; o << "}"; return o; } template std::ostream& operator<<(std::ostream& o, const std::list& lst) { o << "{"; for (auto itr = lst.begin(); itr != lst.end(); itr++) o << (itr == lst.begin() ? "" : ", " ) << *itr; o << "}"; return o; } template std::ostream& operator<<(std::ostream& o, const std::pair& p) { o << "(" << p.first << ", " << p.second << ")"; return o; } template struct Power { static T power(T base, ll exp) { if (exp == 0) { return Monoid::id; } else if (exp & 1) { return Monoid::op(base, power(base, exp - 1)); } else { return power(Monoid::op(base, base), exp >> 1); } } }; const ll MOD = 1000000007; template struct ModularProduct { const static T id = 1; static ll op(T a, T b) { return (a * b) % MOD; } }; ll calc (ll len) { if (len == 0) return 0; else if (len & 1) { return (3 + (calc(len - 1) * 10) % MOD) % MOD; } else { ll res = calc(len >> 1); ll shift = Power >::power(10, len >> 1); return (res + (res * shift) % MOD) % MOD; } } int main() { // cin.tie(0); // ios::sync_with_stdio(false); ll n; cin >> n; ll highest = Power >::power(10, n); ll res = (calc(n) + highest) % MOD; cout << res << "\n"; return 0; }