#include <bits/stdc++.h>
int main() {
  int k;
  long long a = 1, b = 1;
  scanf("%d", &k);
  for (int i = 0; i != k; i++) {
    a *= 27;
    a %= 1000000007;
    b *= 7;
    b %= 1000000007;
  }
  printf("%d", (a - b + 1000000007) % 1000000007);
}
