#include <bits/stdc++.h>
int main() {
  int const N = 1000000007;
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  int n;
  std::cin >> n;
  long long tp1 = 1, tp2 = 1;
  for (int i = 0; i < n; ++i) {
    tp1 *= 27;
    tp1 %= N;
    tp2 *= 7;
    tp2 %= N;
  }
  if (tp1 >= tp2)
    std::cout << tp1 - tp2;
  else
    std::cout << tp1 - tp2 + N;
}
