#include <bits/stdc++.h>
using namespace std;
template <typename T>
class heap : public priority_queue<T, vector<T>, greater<T> > {};
int mod = 1e9 + 7;
long long powmod(long long a, int e) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    e >>= 1;
  }
  return ans;
}
int main(void) {
  int n;
  scanf("%d", &n);
  printf("%lld\n", (powmod(27, n) - powmod(7, n) + mod) % mod);
}
