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