#include <bits/stdc++.h>
using namespace std;
long long int poww(int n, int base) {
  if (n == 1) return base;
  long long int p = poww(n / 2, base);
  p %= 1000000007;
  if (n % 2 == 1)
    return (p * p * base) % 1000000007;
  else
    return (p * p) % 1000000007;
}
long long int modular_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 a, b;
  a = modular_pow(27, n, 1000000007);
  b = modular_pow(7, n, 1000000007);
  cout << ((a - b + 1000000007 + 1000000007) % 1000000007);
  return 0;
}
