#include <bits/stdc++.h>
using namespace std;
const int _max = 1e5 + 10;
const int mod = 1e9 + 7;
long long n, dp[_max], ans;
long long quickpow_mod(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    b >>= 1;
    a = (a * a) % mod;
  }
  return ans;
}
void init() {
  long long x;
  for (int i = 1; i <= 100010; ++i) {
    dp[i] = (quickpow_mod(3, 3 * i) - quickpow_mod(7, i)) % mod;
    if (dp[i] < 0) dp[i] += mod;
  }
}
int main() {
  init();
  while (scanf("%d", &n) == 1) {
    printf("%d\n", dp[n]);
  }
  return 0;
}
