#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long ans = 0;
  long long temp = 1;
  for (long long i = 0; i < n - 3; i++) temp *= 4;
  ans += 2 * temp * 3 * 4;
  temp /= 4;
  ans += (n - 3) * 3 * 3 * 4 * temp;
  cout << ans << endl;
}
signed main() {
  long long t = 1;
  while (t--) {
    solve();
  }
}
