#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int i, j, k, t;
  long long int n, sum = 0;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%lld", &n);
    n = n % (int)(pow(10, 9) + 7);
    sum = n * n % (int)(pow(10, 9) + 7);
    printf("%lld\n", sum);
    sum = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1205 <main+0xd5>
lea    0xe90(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    $0x7,%rcx
movslq %ecx,%rcx
cqto
idiv   %rcx
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    $0x7,%rcx
movslq %ecx,%rcx
cqto
idiv   %rcx
mov    %rdx,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x30>
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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    123b <main+0x10b>
movabs $0x700000000,%r13
lea    0xe96(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xe8f(%rip),%r12
xor    %ebp,%ebp
jmp    11a0 <main+0x70>
nopl   (%rax)
mov    %rbx,%rax
cqto
idiv   %rcx
mov    %rdx,%rsi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    123b <main+0x10b>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rbx
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
shl    $0x20,%rcx
add    %r13,%rcx
sar    $0x20,%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     11f0 <main+0xc0>
mov    %rbx,%rax
cqto
idiv   %rcx
mov    %rdx,%rbx
jmp    11f8 <main+0xc8>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%ebx
mov    %rbx,0x10(%rsp)
imul   %rbx,%rbx
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
shl    $0x20,%rcx
add    %r13,%rcx
sar    $0x20,%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1180 <main+0x50>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%esi
jmp    118b <main+0x5b>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %27
8: ; preds = %0, %8
%9 = phi i32 [ %24, %8 ], [ 0, %0 ]
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = call i64 @pow(i32 10, i32 9)
%13 = shl i64 %12, 32
%14 = add i64 %13, 30064771072
%15 = ashr exact i64 %14, 32
%16 = srem i64 %11, %15
store i64 %16, i64* %2
%17 = mul nsw i64 %16, %16
%18 = call i64 @pow(i32 10, i32 9)
%19 = shl i64 %18, 32
%20 = add i64 %19, 30064771072
%21 = ashr exact i64 %20, 32
%22 = srem i64 %17, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %22)
%24 = add nuw nsw i32 %9, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %24, %25
br i1 %26, label %8, label %27
27: ; preds = %8, %0
ret i32 0
}