using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class Solution {
static void Main(String[] args) {
int t = Convert.ToInt32(Console.ReadLine());
for(int a0 = 0; a0 < t; a0++){
long n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(Difference(n));
}
}
static long Difference(long n)
{
long i= (n*n*n*n +2*n*n*n +n*n)/4;
long j= (2*n*n*n + 3*n*n +n)/6;
return i-j;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW0uTGlucTsKcHVibGljIGNsYXNzIFNvbHV0aW9uIHsKCiAgICBzdGF0aWMgdm9pZCBNYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBpbnQgdCA9IENvbnZlcnQuVG9JbnQzMihDb25zb2xlLlJlYWRMaW5lKCkpOwogICAgICAgIGZvcihpbnQgYTAgPSAwOyBhMCA8IHQ7IGEwKyspewogICAgICAgICAgICBsb25nIG4gPSBDb252ZXJ0LlRvSW50MzIoQ29uc29sZS5SZWFkTGluZSgpKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoRGlmZmVyZW5jZShuKSk7CiAgICAgICAgfQogICAgfQogICAgCiAgICBzdGF0aWMgbG9uZyBEaWZmZXJlbmNlKGxvbmcgbikKICAgIHsKICAgICAgICBsb25nIGk9IChuKm4qbipuICsyKm4qbipuICtuKm4pLzQ7CiAgICAgICAgbG9uZyBqPSAoMipuKm4qbiArIDMqbipuICtuKS82OwogICAgICAgIAogICAgICAgIHJldHVybiBpLWo7CiAgICB9Cn0=