#include #include #define ll long long using namespace std; ll n, m; int main() { int i, j, k, T; ll ans, t; cin >> T; while(T--) { cin >> n; if (n == 2) { cout << 2 << endl; continue; } ans = n; t = 0; for (i = 1; i <= n-3; i++) t += i*(n-2-i); if (n%4 == 0) { n /= 4; } else if (n%2 == 0) { n /= 2; t /= 2; } else if (t%4 == 0) { t /= 4; } ans += t*n; cout << ans << endl; } return 0; }