#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
long long fpow(long long a, long long b) {
  if (b == 0) return 1;
  long long ret = fpow(a * a, b / 2);
  if (b & 1) ret *= a;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  cout << 4 * 3 * 2 * fpow(4, n - 3) + (n - 3) * 4 * 3 * 3 * fpow(4, n - 4)
       << "\n";
}
