#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx2")
using namespace std;
using pii = pair<long long, long long>;
const long long N = 1e6 + 5;
const long long INF = 1e18 + 7;
const long long MOD = 1e9 + 7;
const long long eps = 1e-6;
const long long B = 800;
void solve() {
  long long n;
  cin >> n;
  long long res1 = 1, res2 = 1;
  for (long long i = 1; i <= 3 * n; i++) res1 = (res1 * 3) % MOD;
  for (long long i = 1; i <= n; i++) res2 = (res2 * 7) % MOD;
  cout << (res1 - res2 + MOD) % MOD;
  cout << '\n';
}
long long test = 1;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (test--) solve();
  return 0;
}
