/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int n;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	while(scanf("%d", &n) == 1){
		printf("%d\n", n * n * n * (n * n * n - 1) / 2 - 3 * (n - 1) * n * n);
	}

	return 0;
}
/**/

任选2个有c(n*n*n,2),有4个公共点的必定相连的两个小正方体,根据横,纵,竖三个方向可以得到3*(n-1)*n*n;