#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double pi = 3.1415926;
long long quick_mod(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    b >>= 1;
    a = (a * a) % mod;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  long long ans = quick_mod(27, n);
  long long ret = quick_mod(7, n);
  ret = (ans % mod - ret % mod + mod) % mod;
  cout << ret << endl;
}
