#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  long long mod = 1e9 + 7;
  long long ans, a = 1, b = 1;
  while (n--) {
    a *= 27, b *= 7;
    a %= mod, b %= mod;
  }
  ans = ((a % mod - b % mod) + mod) % mod;
  cout << ans;
  return 0;
}
