#include <bits/stdc++.h>
using namespace std;
long long mo = 1e9 + 7;
int n;
int main() {
  scanf("%d", &n);
  long long res = 1;
  for (int i = 1; i <= 3 * n; i++) res = (res * 3) % mo;
  long long tujuh = 1;
  for (int i = 1; i <= n; i++) {
    tujuh = (tujuh * 7) % mo;
  }
  res = (res - tujuh + mo) % mo;
  cout << res << endl;
  return 0;
}
