#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n;
long long int ans, t;
void Solve() {
  cin >> n;
  ans = 1;
  t = 1;
  for (int i = 0; i < n; ++i) ans = (ans * ((27 * 1ll))) % mod;
  for (int i = 0; i < n; ++i) t = (t * (7 * 1ll)) % mod;
  if (ans - t < (0 * 1ll))
    ans = (mod * 1ll) + (ans - t);
  else
    ans = ans - t;
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}
