#include <bits/stdc++.h>
using namespace std;
int n;
int v = 0, o = 0;
const int mod = 1000000007;
int main() {
  for (int i = 1; i <= 3; ++i)
    for (int j = 1; j <= 3; ++j)
      for (int k = 1; k <= 3; ++k)
        if (i + j + k != 6)
          ++v;
        else
          ++o;
  v += o;
  int tot = 1, bad = 1;
  cin >> n;
  while (n) {
    if (n & 1) {
      tot = (long long)tot * v % mod;
      bad = (long long)bad * o % mod;
    }
    n /= 2;
    v = (long long)v * v % mod;
    o = (long long)o * o % mod;
  }
  cout << (tot + mod - bad) % mod << endl;
}
