#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 */
unsigned long long pow(unsigned long long, int);
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int main() {
  unsigned long long N, T;
  scanf("%Lu", &T);
  while (T--) {
    unsigned long long i = 1;
    unsigned long long s1 = 0, s2 = 0;
    unsigned long long total = 0;
    scanf("%Lu", &N);
    while (i <= N) {
      s1 += pow(i, 2);
      s2 += i;
      i++;
    }
    total = (pow(s2, 2)) - s1;
    printf("%Lu\n", total);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1204 <main+0xd4>
movq   $0x1,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
lea    0xe71(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11d9 <main+0xa9>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1050 <pow@plt>
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1198 <main+0x68>
mov    -0x30(%rbp),%rdi
mov    $0x2,%esi
call   1050 <pow@plt>
sub    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    1168 <main+0x38>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe91(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xe89(%rip),%r12
jmp    11a8 <main+0x78>
nopl   (%rax)
xor    %ebp,%ebp
xor    %r13d,%r13d
mov    %r13,%rdi
mov    $0x2,%esi
call   1050 <pow@plt>
sub    %rbp,%rax
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
subq   $0x1,0x8(%rsp)
jb     1157 <main+0x27>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmpq   $0x0,0x10(%rsp)
je     1180 <main+0x50>
mov    $0x1,%ebx
xor    %r13d,%r13d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <pow@plt>
add    %rax,%rbp
add    %rbx,%r13
add    $0x1,%rbx
cmp    0x10(%rsp),%rbx
jbe    11d0 <main+0xa0>
jmp    1185 <main+0x55>

LLVM IR (-O0):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %9
9: ; preds = %29, %0
%10 = load i64, i64* %3
%11 = add i64 %10, -1
store i64 %11, i64* %3
%12 = icmp ne i64 %10, 0
br i1 %12, label %13, label %36
13: ; preds = %9
store i64 1, i64* %4
store i64 0, i64* %5
store i64 0, i64* %6
store i64 0, i64* %7
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %15
15: ; preds = %19, %13
%16 = load i64, i64* %4
%17 = load i64, i64* %2
%18 = icmp ule i64 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i64, i64* %4
%21 = call i64 @pow(i64 %20, i32 2)
%22 = load i64, i64* %5
%23 = add i64 %22, %21
store i64 %23, i64* %5
%24 = load i64, i64* %4
%25 = load i64, i64* %6
%26 = add i64 %25, %24
store i64 %26, i64* %6
%27 = load i64, i64* %4
%28 = add i64 %27, 1
store i64 %28, i64* %4
br label %15
29: ; preds = %15
%30 = load i64, i64* %6
%31 = call i64 @pow(i64 %30, i32 2)
%32 = load i64, i64* %5
%33 = sub i64 %31, %32
store i64 %33, i64* %7
%34 = load i64, i64* %7
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %34)
br label %9
36: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = add i64 %6, -1
store i64 %7, i64* %2
%8 = icmp eq i64 %6, 0
br i1 %8, label %32, label %9
9: ; preds = %0, %23
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%11 = load i64, i64* %1
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %9, %13
%14 = phi i64 [ %19, %13 ], [ 0, %9 ]
%15 = phi i64 [ %18, %13 ], [ 0, %9 ]
%16 = phi i64 [ %20, %13 ], [ 1, %9 ]
%17 = call i64 @pow(i64 %16, i32 2)
%18 = add i64 %17, %15
%19 = add i64 %14, %16
%20 = add i64 %16, 1
%21 = load i64, i64* %1
%22 = icmp ugt i64 %20, %21
br i1 %22, label %23, label %13
23: ; preds = %13, %9
%24 = phi i64 [ 0, %9 ], [ %18, %13 ]
%25 = phi i64 [ 0, %9 ], [ %19, %13 ]
%26 = call i64 @pow(i64 %25, i32 2)
%27 = sub i64 %26, %24
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %27)
%29 = load i64, i64* %2
%30 = add i64 %29, -1
store i64 %30, i64* %2
%31 = icmp eq i64 %29, 0
br i1 %31, label %32, label %9
32: ; preds = %23, %0
ret i32 0
}