#include <bits/stdc++.h>
using namespace std;
long long i, j, k, t, x, y, z, n;
long long INF = 1e15 + 7;
long long power(long long base, long long pow) {
  long long a = base, res = 1;
  while (pow) {
    if (pow % 2 == 0) {
      a = ((a) * (a));
      pow /= 2;
    }
    pow--;
    res = ((res) * (a));
  }
  return res;
}
int main() {
  cin >> n;
  cout << 2 * 3 * 4 * power(4, n - 3) +
              4 * 3 * 3 * power(4, max(n - 4, 0LL)) * (n - 3);
}
