#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ ll T, N; cin >> T; while(T){ T--; cin >> N; cout << (N-2) * (N-1) * N / 3 * 2 << endl; } return 0; }