#include <bits/stdc++.h>
using namespace std;
long long n;
const int mod = 1e9 + 7;
long long binpow(long long a, long long n) {
  long long res = 1ll;
  while (n) {
    if (n % 2 == 1) {
      res *= a;
      res %= mod;
    }
    a *= a;
    a %= mod;
    n >>= 1ll;
  }
  return res;
}
int main() {
  cin >> n;
  long long sol = (binpow(3ll, 3ll * n) - binpow(7ll, n));
  if (sol < 0) sol += mod;
  cout << sol;
  return 0;
}
