#include <bits/stdc++.h>
const long long modulo = 1000000007ll;
int n;
long long solved() {
  long long seven = 1;
  long long three = 1;
  for (int i = 1; i <= n; ++i) {
    seven *= 7;
    three *= 3;
    seven %= modulo;
    three %= modulo;
  }
  for (int i = 1; i <= n * 2; ++i) {
    three *= 3;
    three %= modulo;
    ;
  }
  if (three > seven)
    return three - seven;
  else
    return three + modulo - seven;
}
int main() {
  scanf("%d", &n);
  printf("%I64d", solved());
}
