#include <bits/stdc++.h>
const int mod = 1000000007;
int n, T;
long long sum, sun;
int main() {
  while (scanf("%d", &n) != EOF) {
    sum = 1, sun = 1;
    int falg = 0;
    for (int i = 0; i < n; i++) {
      sun *= 7;
      sun %= mod;
    }
    for (int i = 0; i < n; i++) {
      sum *= 27;
      sum %= mod;
    }
    sum -= sun;
    if (sum < 0) sum += mod;
    printf("%I64d\n", sum);
  }
  return 0;
}
