#include <bits/stdc++.h>
using namespace std;
long long pow1(long long a, long long b, long long mod) {
  if (b == 0) return 1;
  long long ret = pow1(a, b / 2, mod);
  ret = (ret * ret) % mod;
  if (b & 1) ret = (a * ret) % mod;
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  printf("%lld\n",
         (pow1(27, n, 1000000007) - pow1(7, n, 1000000007) + 1000000007) %
             1000000007);
}
