#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MXN = 1e5 + 1;
int n;
int main() {
  scanf("%d", &n);
  long long mult = 1, mult1 = 1;
  for (int i = 1; i <= n; i++) mult = (mult * 27LL) % MOD;
  for (int i = 1; i <= n; i++) mult1 = (mult1 * 7LL) % MOD;
  mult -= mult1;
  while (mult < 0) mult += MOD;
  printf("%d", mult);
  return 0;
}
