#include #include #include using namespace std; int main() { int T, n; scanf("%d", &T); while(T--) { scanf("%d", &n); unsigned long long ans = 0; for(int i = 2; i <= n; i++) { ans += (long long)(i - 2) * (n - i); } int cnt = 2; while(cnt > 0 && ans % 2 == 0) { cnt--; ans /= 2; } int N = n; while(cnt > 0 && n % 2 == 0) { cnt--; n /= 2; } printf("%I64u\n", ans * n + N); } return 0; }