#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  scanf("%d", &n);
  long long int big = 1, small = 1;
  for (int i = 1; i <= 3 * n; i++) big = (big * 3) % 1000000007;
  for (int i = 1; i <= n; i++) small = (small * 7) % 1000000007;
  if (big >= small)
    printf("%lld", big - small);
  else
    printf("%lld", big + 1000000007 - small);
  return 0;
}
