#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int sixes = 1;
  int all = 1;
  for (int i = 0; i < (int)n; ++i) {
    sixes = sixes * 1ll * 7 % MOD;
    all = all * 1ll * 27 % MOD;
  }
  cout << (all - sixes + MOD) % MOD;
  return 0;
}
