#include <bits/stdc++.h>
using namespace std;
int n;
long long power(int a, int b) {
  long long ret = 1, t = a;
  while (b) {
    if (b & 1) ret = (ret * t) % 1000000007;
    t = (t * t) % 1000000007;
    b >>= 1;
  }
  return ret;
}
int main(int argc, const char* argv[]) {
  cin >> n;
  long long total = power(3, 3 * n);
  long long unsatisfied = power(7, n);
  cout << (total - unsatisfied + 1000000007) % 1000000007 << endl;
  return 0;
}
