#include <bits/stdc++.h>
long long maxv = 1e9 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  long long div1 = 1, div2 = 1;
  for (int i = 1; i <= (3 * N); i++) {
    div1 = (div1 * 3LL) % maxv;
  }
  for (int i = 1; i <= (N); i++) {
    div2 = (div2 * 7LL) % maxv;
  }
  cout << (div1 - div2 + maxv) % maxv;
  return 0;
}
