#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long mod_pow(long long x, long long y) {
  long long r = 1;
  while (y > 0) {
    if (y & 1) r = r * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return r;
}
int main() {
  long long n;
  cin >> n;
  cout << (mod_pow(3, 3 * n) - mod_pow(7, n) + MOD) % MOD << endl;
}
