#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, mod = 1000000007, a = 1, b = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    a = a * 27 % mod;
    b = b * 7 % mod;
  }
  cout << (mod + a - b) % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
