#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010];
void init() {
  a[0] = 1;
  b[0] = 1;
  for (int i = 0; i < 100010 - 1; i++) {
    a[i + 1] = (a[i] * 27) % 1000000007;
    b[i + 1] = (b[i] * 7) % 1000000007;
  }
}
void solve() {
  int n;
  scanf("%d", &n);
  long long x = a[n] - b[n];
  if (x < 0) x += 1000000007;
  printf("%lld\n", x);
}
int main() {
  int t = 1;
  init();
  for (int i = 1; i <= t; i++) {
    solve();
  }
}
