#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 1000000007;
  scanf("%d", &n);
  int ans = 1, r = 1;
  for (int i = 0; i < n; ++i) ans = (1ll * ans * 27) % m, r = (1ll * r * 7) % m;
  ans = (1ll * ans - r + m) % m;
  printf("%d\n", ans);
  return 0;
}
