#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 *, unsigned long long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int cases;
  scanf("%d", &cases);
  while (cases--) {
    unsigned long long a, b, c = 0;
    scanf("%llu", &a);
    b = a;
    while (b != 0) {
      c = (c % 1000000007 +
           ((a / b) % 1000000007 * b % 1000000007) % 1000000007);
      b--;
    }
    printf("%llu\n", c % 1000000007);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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     120a <main+0xea>
movq   $0x0,-0x20(%rbp)
lea    0xe9f(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11e8 <main+0xc8>
mov    -0x20(%rbp),%rax
mov    $0x3b9aca07,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    $0x3b9aca07,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
imul   -0x18(%rbp),%rax
mov    $0x3b9aca07,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
mov    $0x3b9aca07,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
mov    -0x28(%rbp),%rdx
add    %rax,%rdx
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1177 <main+0x57>
mov    -0x20(%rbp),%rax
mov    $0x3b9aca07,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rsi
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    1157 <main+0x37>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xea5(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xe9e(%rip),%r12
movabs $0x89705f3112a28fe5,%r13
5f 70 89
jmp    11af <main+0x8f>
cs nopw 0x0(%rax,%rax,1)
mov    %esi,%eax
imul   $0x12e0be63,%rax,%rax
shr    $0x20,%rax
mov    %esi,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x1d,%ecx
imul   $0x3b9aca07,%ecx,%eax
sub    %eax,%esi
mov    %r12,%rdi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jb     1147 <main+0x27>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%rbx
mov    $0x0,%esi
mov    %rbx,%rcx
test   %rbx,%rbx
jne    1214 <main+0xf4>
jmp    1180 <main+0x60>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
mov    %rax,%rdi
mov    %rdi,%rax
mul    %r13
shr    $0x1d,%rdx
imul   $0x3b9aca07,%rdx,%rax
sub    %rax,%rdi
imul   %rcx,%rdi
mov    %rdi,%rax
mul    %r13
shr    $0x1d,%rdx
imul   $0x3b9aca07,%rdx,%rax
sub    %rax,%rdi
add    %rdi,%rsi
add    $0xffffffffffffffff,%rcx
je     1180 <main+0x60>
mov    %rsi,%rax
mul    %r13
shr    $0x1d,%rdx
imul   $0x3b9aca07,%rdx,%rax
sub    %rax,%rsi
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    11d0 <main+0xb0>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
jmp    11db <main+0xbb>

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
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %31, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %35
11: ; preds = %7
store i64 0, i64* %5
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%13 = load i64, i64* %3
store i64 %13, i64* %4
br label %14
14: ; preds = %17, %11
%15 = load i64, i64* %4
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = load i64, i64* %5
%19 = urem i64 %18, 1000000007
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = udiv i64 %20, %21
%23 = urem i64 %22, 1000000007
%24 = load i64, i64* %4
%25 = mul i64 %23, %24
%26 = urem i64 %25, 1000000007
%27 = urem i64 %26, 1000000007
%28 = add i64 %19, %27
store i64 %28, i64* %5
%29 = load i64, i64* %4
%30 = add i64 %29, -1
store i64 %30, i64* %4
br label %14
31: ; preds = %14
%32 = load i64, i64* %5
%33 = urem i64 %32, 1000000007
%34 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %33)
br label %7
35: ; preds = %7
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 %34, label %8
8: ; preds = %0
%9 = bitcast i64* %2 to i8*
br label %10
10: ; preds = %8, %25
%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 = icmp eq i64 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %10, %14
%15 = phi i64 [ %22, %14 ], [ 0, %10 ]
%16 = phi i64 [ %23, %14 ], [ %12, %10 ]
%17 = urem i64 %15, 1000000007
%18 = udiv i64 %12, %16
%19 = urem i64 %18, 1000000007
%20 = mul i64 %19, %16
%21 = urem i64 %20, 1000000007
%22 = add nuw nsw i64 %21, %17
%23 = add i64 %16, -1
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %14
25: ; preds = %14, %10
%26 = phi i64 [ 0, %10 ], [ %22, %14 ]
%27 = trunc i64 %26 to i32
%28 = urem i32 %27, 1000000007
%29 = zext i32 %28 to i64
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %29)
%31 = load i32, i32* %1
%32 = add nsw i32 %31, -1
store i32 %32, i32* %1
%33 = icmp eq i32 %31, 0
br i1 %33, label %34, label %10
34: ; preds = %25, %0
ret i32 0
}