#include <bits/stdc++.h>
using namespace std;
const int64_t mod = 1000000007;
int main() {
  int n;
  cin >> n;
  int64_t ways = 1;
  for (int i = 0; i < 3 * n; ++i) {
    ways *= 3;
    ways %= mod;
  }
  int64_t bad = 1;
  for (int i = 0; i < n; ++i) {
    bad *= 7;
    bad %= mod;
  }
  cout << (mod + (ways - bad) % mod) % mod << endl;
  return 0;
}
