#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int bpow(int a, int n) {
  int res = 1;
  while (n > 0) {
    if ((n & 1) != 0) {
      res = (((long long)res * a) % MOD);
    }
    a = (((long long)a * a) % MOD);
    n >>= 1;
  }
  return res;
}
int main(int argc, char* argv[]) {
  int n;
  scanf("%d", &n);
  printf("%d\n", (bpow(3, 3 * n) - bpow(7, n) + MOD) % MOD);
  return 0;
}
