#include <bits/stdc++.h>
using namespace std;
long long modular_pow(long long base, long long exponent) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % 1000000007;
    exponent = exponent >> 1;
    base = (base * base) % 1000000007;
  }
  return result;
}
int main() {
  long long n;
  cin >> n;
  cout << (modular_pow(3, 3 * n) - modular_pow(7, n) + 1000000007) % 1000000007;
  return 0;
}
