#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long ans = 1;
  for (int i = 1; i <= 3 * n; i++) {
    ans = (ans * 3LL) % mod;
  }
  long long rem = 1;
  for (int i = 1; i <= n; i++) {
    rem = (rem * 7LL) % mod;
  }
  cout << (ans - rem + mod) % mod << endl;
}
