#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int ans = 1;
  long long int i;
  for (i = 1; i <= 3 * n; i++) {
    ans = ((ans % mod) * (3 % mod)) % mod;
  }
  long long int ans1 = 1, ansf;
  for (i = 1; i <= n; i++) {
    ans1 = ((ans1 % mod) * (7 % mod)) % mod;
  }
  ansf = ((ans % mod) - (ans1 % mod) + mod) % mod;
  cout << ansf << "\n";
  cerr << "\nTime elapsed:" << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
