#include using namespace std; int t; long long n; int main(){ cin >> t; for(int j = 0; j < t; j++){ cin >> n; cout << n * (n - 1) * (n - 2) / 3 * 2 << endl; } }