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