#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long res1 = 1;
  long long res2 = 1;
  for (int i = 0; i < n; ++i) {
    res1 *= 27;
    res1 %= 1000000007;
  }
  for (int i = 0; i < n; ++i) {
    res2 *= 7;
    res2 %= 1000000007;
  }
  long long res3 = (1000000007 + res1 - res2) % 1000000007;
  cout << res3;
  return 0;
}
