#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long a = 1, b = 1;
  for (long long i = 0; i < n; i++) {
    a = a * 27 % MOD;
    b = b * 7 % MOD;
  }
  long long ans = a - b;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
