#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
long long Power(long long aaa, long long bbb) {
  long long result = 1;
  aaa %= 1000000007;
  while (bbb) {
    if (bbb % 2 == 1) result *= aaa;
    aaa *= aaa;
    aaa %= 1000000007;
    result %= 1000000007;
    bbb /= 2;
  }
  return result;
}
void solv() {
  long long n;
  cin >> n;
  cout << (Power(3, 3 * n) - Power(7, n) + 1000000007) % 1000000007 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test_cases = 1;
  for (long long loop_var = 1; loop_var <= test_cases; loop_var++) {
    solv();
  }
  return 0;
}
