#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
ll fpow(int a, int b) {
  if (b == 0) return 1;
  if (b & 1) return a * fpow(a, b - 1) % mod;
  ll aux = fpow(a, b / 2) % mod;
  return aux * aux % mod;
}
int main() {
  int n;
  cin >> n;
  ll ans = (fpow(3, 3 * n) % mod + mod - fpow(7, n) % mod) % mod;
  cout << ans << '\n';
}
