#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long pot(long long b, long long e) {
  if (e == 0) return 1;
  long long x = pot(b, e / 2);
  x = (x * x) % mod;
  if (e & 1) x = (x * b) % mod;
  return x;
}
int main() {
  long long n;
  scanf("%I64d", &n);
  long long res = pot(3, (3 * n));
  res = (res + mod - pot(7, n)) % mod;
  printf("%I64d\n", res);
  return 0;
}
