#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int k = 1, l = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    k = (k * 27) % (1000000007);
    l = (l * 7) % (1000000007);
  }
  k = k - l;
  if (k < 0) k = k + 1000000007;
  cout << k << endl;
}
