#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long an1 = 1, an2 = 1;
  for (int i = 0; i < n; ++i) {
    an1 = (an1 * 7) % 1000000007;
  }
  for (int i = 0; i < 3 * n; ++i) {
    an2 = (an2 * 3) % 1000000007;
  }
  long long ot = an2 - an1;
  while (ot < 0) ot += 1000000007;
  cout << ot;
  return 0;
}
