#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
long long epow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = 1LL * res * x;
    x = 1LL * x * x;
    n >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long x1, x2;
  x1 = x2 = 0;
  x1 = 1LL * 2 * 4 * 3 * epow(4, n - 3);
  if (n - 4 >= 0) x2 = 1LL * (n - 3) * 4 * 3 * 3 * epow(4, n - 4);
  cout << x1 + x2 << endl;
  return 0;
}
