#include<stdio.h>
#include<math.h>
#include<stdint.h>
int main(){
uint64_t n,ans;int t;
scanf("%d",&t);
while(t--){
scanf("%llu",&n);
ans=(n*(14*(n*n)+9*n+2))/4;
printf("%llu\n",ans);
}return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8bWF0aC5oPgojaW5jbHVkZTxzdGRpbnQuaD4KaW50IG1haW4oKXsKCXVpbnQ2NF90IG4sYW5zO2ludCB0OwoJc2NhbmYoIiVkIiwmdCk7Cgl3aGlsZSh0LS0pewoJCXNjYW5mKCIlbGx1Iiwmbik7CgkJYW5zPShuKigxNCoobipuKSs5Km4rMikpLzQ7CgkJcHJpbnRmKCIlbGx1XG4iLGFucyk7CgkJfXJldHVybiAwOwoJCX0gICAK