typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll t; std::cin >> t; for (int iii = 0; iii < t; iii++) { ll n; std::cin >> n; std::cout << n*(n-1)*(n-2)*2/3 << std::endl; } }