/*不管折现 我们考虑直线的话那么 ,多一条线多一个点,那么折线类似自己画一下因为自己不可能和自己相交所以多一条折线多,多2*n个点,
那么面数比多出来的点数多1所以就有了公式,a[j] = a[j-1] + 4*(j-1) + 1*/
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
ll a[10010];
int main()
{
int n;
while(scanf("%d", &n) != EOF){
while(n--){
int t;
scanf("%d", &t);
a[1] = 2;
for(int j = 2; j <= t; j++){
a[j] = a[j-1]+4*(j-1)+1;
}
cout << a[t] << endl;
}
}
return 0;
}