#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int triangles, total = 1, na6 = 1;
  long long int combinations, res = 1e9 + 7;
  cin >> triangles;
  for (int i = 0; i < triangles * 3; i++) {
    total = (total * 3) % res;
  }
  for (int i = 0; i < triangles; i++) {
    na6 = (na6 * 7) % res;
  }
  combinations = (total - na6 + res) % res;
  cout << combinations;
  return 0;
}
