#include <bits/stdc++.h>
int main(void) {
  int n;
  scanf("%d", &n);
  long long all = 1, withZero = 1;
  for (int i = 0; i < n; i++) {
    all *= 27;
    all %= 1000000007;
    withZero *= 7;
    withZero %= 1000000007;
  }
  printf("%I64d\n", ((all - withZero) + 1000000007) % 1000000007);
  return 0;
}
