#include <bits/stdc++.h>
using namespace std;
long long modular_power(long long base, long long exponent, long long mod) {
  long long ans = 1;
  base %= mod;
  while (exponent > 0) {
    if (exponent & 1) {
      ans = (ans * base) % mod;
    }
    exponent >>= 1;
    base = (base * base) % mod;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long mod = 1e9 + 7;
  long long n;
  cin >> n;
  long long a = modular_power(3, 3 * n, mod);
  long long b = modular_power(7, n, mod);
  a -= b;
  if (a < 0) {
    a += mod;
  }
  cout << a;
  return 0;
}
