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