#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int mod = 1000000007;
int main() {
  int i, j, n, m;
  cin >> n;
  long long s = 1;
  for (i = 0; i < 3 * n; i++) {
    s = s * 3;
    s %= mod;
  }
  long long s1 = 1;
  for (i = 0; i < n; i++) {
    s1 = s1 * 7;
    s1 %= mod;
  }
  s = s - s1;
  s = (s % mod + mod) % mod;
  cout << s << endl;
}
