#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  while (scanf("%I64d", &n) != EOF) {
    long long sum =
        4 * 3 * pow(4, n - 3) * 2 + 4 * 3 * 3 * pow(4, n - 4) * (n - 3);
    printf("%I64d\n", sum);
  }
  return 0;
}
