#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<vector>
#include<iomanip>
#include <numeric>
#include<iomanip>
#include <bitset>
#define OmarNasr {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
using namespace std;
int main()
{
OmarNasr;
unsigned long long t,n;
cin >> t;
while (t--) {
cin >> n;
unsigned long long sum = 0, c = n;
n--;
sum = ((n * (n + 1)) / 2) * (n+1) + (c * (c + 1)) / 2;
cout << sum << "\n";
}
return 0;
}