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