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