#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7, mod = 1e9 + 9, pw = 31;
const double eps = 1e-11;
long long binpow(long long a, long long b) {
  long long rec = 1;
  while (b) {
    if (b % 2 == 1) {
      rec *= a;
      rec %= INF;
    }
    a *= a;
    a %= INF;
    b /= 2;
  }
  return rec;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long x = binpow(3, n * 3) - binpow(7, n);
  if (x < 0) x += INF;
  cout << x;
  return 0;
}
