#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long res =
      2 * 4 * 3 * pow(4, n - 3) + pow(3, 2) * 4 * pow(4, n - 4) * (n - 3);
  cout << res << endl;
}
