#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long INFll = 1000000000000000000ll;
const long double EPS = 1e-13;
const int MOD = 1000000007;
int main() {
  cin.tie();
  ios_base::sync_with_stdio();
  int n;
  cin >> n;
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (ans * 27) % MOD;
  long long x = 1;
  for (int i = 0; i < n; i++) x = (x * 7) % MOD;
  ans -= x;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
