#pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; template inline T sqr(T x) { return x * x; } typedef long long LL; typedef unsigned long long ULL; typedef long double db; typedef pair PII; typedef pair PIII; typedef pair PLL; typedef pair PLI; typedef pair PDD; #define MP make_pair #define PB push_back #define sz(x) ((int)(x).size()) #define mem(ar,val) memset(ar, val, sizeof(ar)) #define istr stringstream #define FOR(i,n) for(int i=0;i<(n);++i) #define forIt(mp,it) for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++) const double EPS = 1e-6; const int INF = 0x3fffffff; const LL LINF = INF * 1ll * INF; const double PI = acos(-1.0); const int maxn= 1e6+10; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define lowbit(u) (u&(-u)) using namespace std; #define lowbit(a) a&-a int dir4[4][2]= {{1,0},{0,1},{-1,0},{0,-1}}; int dir8[8][2]= {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}}; int dir6[6][3]= {{0,0,1},{0,0,-1},{0,1,0},{0,-1,0},{1,0,0},{-1,0,0}};///六个方向 int movv[5][2]= {{1,0},{0,1},{0,0},{-1,0},{0,-1}}; inline LL read() { int c=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { c=c*10+ch-'0'; ch=getchar(); } return c*f; } LL a[maxn]= {0,0,2,3,5}; int main() { // for(int i=5; i<=100000; ++i) a[i]=a[i-1]+a[i-2]+a[i-3]; int t;t=read(); while(t--) { LL n;n=read(); LL ret=n; for(LL i=2; i<=n-2; ++i) { LL x1=n-i-1; LL x2=i-1; LL x3=i-1+(i-1)*(x1-1); LL x4=x2+x3; x4*=x1; x4/=2; ret+=x4; } printf("%lld\n",ret); } return 0; }