#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
long long fpow(long long a, int b) {
  long long m = 1;
  while (b) {
    if (b & 1) m = m * a % inf;
    b >>= 1;
    a = a * a % inf;
  }
  return m;
}
int main() {
  int n;
  cin >> n;
  long long ans = fpow(3ll, n * 3) - fpow(7ll, n);
  ans = (ans + inf) % inf;
  cout << ans << endl;
  return 0;
}
