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