#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 250;
long long mod = 1e9 + 7;
const int N = 100005;
int main() {
  long long n, t;
  cin >> n;
  t = 1;
  for (int i = 0; i < n - 4; i++) t = t * 4;
  if (n == 3) {
    puts("24");
    return 0;
  }
  cout << (n - 3) * 4 * 3 * 3 * t + 2 * 4 * 3 * t * 4 << endl;
  return 0;
}
