#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MOD = 1e9 + 7;
int N;
int main(void) {
  while (cin >> N) {
    long long res = 1;
    for (int i(0); i < 3 * N; ++i) {
      res *= 3;
      res %= MOD;
    }
    long long minus = 1;
    for (int i(0); i < N; ++i) {
      minus *= 7;
      minus %= MOD;
    }
    res = (res - minus) % MOD;
    if (res < 0) res += MOD;
    cout << res << '\n';
  }
  return 0;
}
