#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void remin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void remax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T>
T power(T a, T b, T m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
void solve() {
  long long n;
  cin >> n;
  long long mod = 1e9 + 7;
  long long ans = (power(3LL, (3 * n), mod) - power(7LL, n, mod));
  ans += mod;
  cout << ans % mod << "\n";
  ;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
