#include <bits/stdc++.h>
using namespace std;
long long int power(unsigned long long int n) {
  unsigned long long int res = 1;
  for (long int i = 0; i < 3 * n; i++) {
    res = (res * 3) % 1000000007;
  }
  unsigned long long int res2 = 1;
  for (long int i = 0; i < n; i++) {
    res2 = (res2 * 7) % 1000000007;
  }
  return (res - res2 + 1000000007) % 1000000007;
}
int main() {
  long int n;
  cin >> n;
  cout << power(n);
}
