/** * @FileName a.cpp * @Author kanpurin * @Created 2022.01.30 08:59:43 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { const int max_n = 1000000; vector dp(max_n+1); dp[3] = 4; for (int i = 4; i <= max_n; i++) { dp[i] = dp[i-1]+(ll)(i-1)*(i-2)*2; } int t;cin >> t; for (int i = 0; i < t; i++) { int n;cin >> n; cout << dp[n] << endl; } return 0; }