#include <bits/stdc++.h>
using namespace std;
long long const int MOD = 1000000007;
long long powermod(long long base, long long exp, long long mod) {
  long long result = 1;
  while (exp) {
    if (exp % 2) {
      result = (result * base) % mod;
    }
    base = (base * base) % mod;
    exp /= 2;
  }
  return result;
}
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  long long ans = (powermod(3, n * 3, MOD) - powermod(7, n, MOD) + MOD) % MOD;
  ;
  cout << ans;
}
