#include using namespace std; const int MOD = 1000000007; /* (1,1) (8,8) (0,0) (6,9) (9,6) */ long long pow(long long x, long long n, long long mod) { long long ans = 1; while (n) { if (n % 2) ans *= x; x *= x; x %= mod; ans %= mod; n >>= 1; } return ans; } long long solve(long long N) { long long d = N / 2; return 4LL * pow(5, d - 1, MOD) % MOD; } int main() { long long N; cin >> N; if (N == 1) { cout << 2 << endl; return 0; } if (N % 2 == 1) { cout << solve(N - 1) * 3LL % MOD << endl; } else { cout << solve(N) << endl; } }