#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, l, m, n;
  cin >> n;
  long long po = 1, bad = 1;
  for (i = 1; i <= 3 * n; i++) {
    po = (po * 3ll) % 1000000007;
  }
  for (i = 1; i <= n; i++) {
    bad = (bad * 7ll) % 1000000007;
  }
  long long ans = po;
  ans -= bad;
  ans = (ans + 1000000007) % 1000000007;
  cout << ans << '\n';
}
