#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, mod = 1000000007;
  cin >> n;
  long long a = 1LL, b = 1LL, c = 1LL;
  for (int i = 0; i < 3 * n; i++) {
    a *= 3;
    a %= mod;
  }
  for (int i = 0; i < n; i++) {
    b *= 7;
    b %= mod;
  }
  long long ans = (a - b) % mod;
  while (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
