#include <bits/stdc++.h>
int i;
using namespace std;
long long powerthree(int x) {
  long long k = 1;
  for (i = 1; i <= x; ++i) {
    k *= 3;
    k %= 1000000007;
  }
  return k;
}
long long powerseven(int x) {
  long long k = 1;
  for (i = 1; i <= x; ++i) {
    k *= 7;
    k %= 1000000007;
  }
  return k;
}
int main() {
  int x;
  cin >> x;
  long long tt = powerthree(x * 3);
  long long ts = powerseven(x);
  tt -= ts;
  tt += 1000000007;
  tt %= 1000000007;
  cout << tt << endl;
}
