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