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