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