#include <iostream>using namespace std;long long a[10005];void sum(){a[1]=2;a[2]=7;for(int i=3;i<10000;i++){a[i]=a[i-1]+i*4*2-3;}}int main(){int c;long long b;cin>>c;sum();while(c--){cin>>b;cout<<a[b]<<endl;}return 0;}