#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int cases;
  scanf("%d", &cases);
  while (cases--) {
    long long n;
    scanf("%llu", &n);
    long long ans = n * (n + 2) * (2 * n + 1) / 8;
    printf("%llu\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11aa <main+0x8a>
lea    0xea7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x2,%rcx
imul   %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x1,%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     11a3 <main+0x83>
lea    0xeb9(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xeb2(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%rax
lea    0x2(%rax),%rcx
imul   %rax,%rcx
add    %rax,%rax
add    $0x1,%rax
imul   %rcx,%rax
lea    0x7(%rax),%rsi
test   %rax,%rax
cmovns %rax,%rsi
sar    $0x3,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jae    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%12 = load i64, i64* %3
%13 = load i64, i64* %3
%14 = add nsw i64 %13, 2
%15 = mul nsw i64 %12, %14
%16 = load i64, i64* %3
%17 = mul nsw i64 2, %16
%18 = add nsw i64 %17, 1
%19 = mul nsw i64 %15, %18
%20 = sdiv i64 %19, 8
store i64 %20, i64* %4
%21 = load i64, i64* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %21)
br label %6
23: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, -1
store i32 %6, i32* %1
%7 = icmp eq i32 %5, 0
br i1 %7, label %23, label %8
8: ; preds = %0
%9 = bitcast i64* %2 to i8*
br label %10
10: ; preds = %8, %10
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%12 = load i64, i64* %2
%13 = add nsw i64 %12, 2
%14 = mul nsw i64 %13, %12
%15 = shl nsw i64 %12, 1
%16 = or i64 %15, 1
%17 = mul nsw i64 %14, %16
%18 = sdiv i64 %17, 8
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %18)
%20 = load i32, i32* %1
%21 = add nsw i32 %20, -1
store i32 %21, i32* %1
%22 = icmp eq i32 %20, 0
br i1 %22, label %23, label %10
23: ; preds = %10, %0
ret i32 0
}