#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define FOR(i, m, n) for(int i=(m); i<(n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define Cout(x) cout << (x) << endl #define dump(x) cerr << #x << " = " << (x) << endl; typedef long long LL; typedef vector VI; typedef vector VL; typedef vector VS; typedef vector> VVI; typedef pair PII; const int inf = (int)1e9; const long long mod = (long long)1e9 + 7; const double pi = acos(-1.0); //x^n%m long long Powmod(long long x, long long n, long long m) { long long ans = 1; while (0 < n) { if (n % 2 == 0)x = x * x % m, n >>= 1; else ans = ans * x % m, n--; } return ans; } long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } int main() { LL n; cin >> n; LL a = (4 * Powmod(10, n, mod) - 1) % mod; Cout(a * modinv(3, mod) % mod); }