Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#ifndef ZIKKEN
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY 1000000007

int mul(int a, int b) {
	return (int64_t)a * b % MOD_BY;
}

int pow_i(int a, int n) {
	int r = 1;
	while (n > 0) {
		if (n & 1) r = mul(r, a);
		a = mul(a, a);
		n >>= 1;
	}
	return r;
}

int inv(int a) {
	return pow_i(a, MOD_BY - 2);
}

int div(int a, int b) {
	return mul(a, inv(b));
}

int add(int a, int b) {
	int x = a + b;
	if (x >= MOD_BY) x -= MOD_BY;
	return x;
}

int sub(int a, int b) {
	int x = b == 0 ? 0 : MOD_BY - b;
	return add(a, x);
}

#define MAX 200000

int N;
int A[MAX];

int mofu[MAX * 2];

int main(void) {
	int i;
	int all;
	int result = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	all = 1;
	for (i = 1; i <= N; i++) all = mul(all, i);
	mofu[N] = all;
	for (i = 0; i < N; i++) {
		mofu[N - i] = mofu[N + i] = div(all, i + 1);
	}
	for (i = 1; i <= N + N; i++) mofu[i] = add(mofu[i - 1], mofu[i]);
	for (i = 0; i < N; i++) {
		int ruiseki = sub(mofu[i + N], mofu[i]);
		result = add(result, mul(A[i], ruiseki));
	}
	printf("%d\n", result);
	return 0;
}

/*
s(x, y) = answer for [x, y)
c(x, y) = cost (ruisekiwa) for {x, y)

s(0, 3) = c(0, 3) +
	s(0, 0) + s(1, 3) +
	s(0, 1) + s(2, 3) +
	s(0, 2) + s(3, 3)

s(0, 0) = 0
s(1, 3) = c(1, 3) +
	s(1, 1) + s(2, 3) +
	s(1, 2) + s(3, 3)
s(0, 1) = c(0, 1)
s(2, 3) = c(2, 3)
s(0, 2) = c(0, 2) +
	s(0, 0) + s(1, 2) +
	s(0, 1) + s(2, 2)
s(3, 3) = 0
s(1, 1) = 0
s(1, 2) = c(1, 2)

s(0, 3) = c(0, 3) +
	c(1, 3) + c(2, 3) + c(1, 2) +
	c(0, 1) + c(2, 3) +
	c(0, 2) + c(1, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) + c(1, 3) + c(2, 3) +
	c(0, 3) + c(1, 3) + c(1, 2) +
	c(0, 3) + c(0, 1) + c(2, 3) +
	c(0, 3) + c(2, 3) + c(0, 1) +
	c(0, 3) + c(0, 2) + c(1, 2) +
	c(0, 3) + c(0, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) * 6 +
	c(0, 2) * 2 + c(1, 3) * 2 +
	c(0, 1) * 3 + c(1, 2) * 2 + c(2, 3) * 3

s(0, 2) =
	c(0, 2) + c(1, 2) +
	c(0, 2) + c(0, 1)

s(0, 2) =
	c(0, 2) * 2 +
	c(0, 1) * 1 + c(1, 2) * 1

*/
#else
#include <stdio.h>
#include <stdlib.h>

/* {1,2,3} -> ... -> {3,2,1} */
int next_permutation(int arr[],int n) {
	int target;
	int i;
	int temp;
	for (i = n - 2; i >= 0; i--) {
		if (arr[i] < arr[i + 1]) break;
	}
	if (i < 0) return 0;
	target = i;

	for (i = 0; target + i + 1 < n - i - 1; i++) {
		temp = arr[target + 1 + i];
		arr[target + 1 + i] = arr[n - 1 - i];
		arr[n - i - 1] = temp;
	}

	for (i = target + 1; i < n; i++) {
		if (arr[i] > arr[target]) break;
	}
	temp = arr[i];
	arr[i] = arr[target];
	arr[target] = temp;
	return 1;
}

int main(void) {
	int N;
	int i, j, k;
	int *order;
	char *exists;
	int *count;
	int *count2;
	if (scanf("%d", &N) != 1) return 1;
	if ((order = malloc(sizeof(int) * N)) == NULL) return 1;
	if ((exists = malloc(sizeof(char) * N)) == NULL) {
		free(order);
		return 1;
	}
	if ((count = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		return 1;
	}
	if ((count2 = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		free(count);
		return 1;
	}
	for (i = 0; i < N * N; i++) count[i] = count2[i] = 0;
	for (i = 0; i < N; i++) order[i] = i;
	do {
		for (i = 0; i < N; i++) exists[i] = 1;
		for (i = 0; i < N; i++) {
			int left, right;
			left = right = order[i];
			while (left >= 0 && exists[left]) left--;
			while (right < N && exists[right]) right++;
			count[(left + 1) * N + (right - 1)]++;
			if (0) printf("%d -> %d %d\n", order[i], left + 1, right - 1);
			exists[order[i]] = 0;
			for (j = left + 1; j < right; j++) {
				count2[order[i] * N + j]++;
			}
		}
	} while (next_permutation(order, N));
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	for (i = 0; i < N; i++) {
		int sum = 0;
		for (j = 0; j <= i; j++) {
			for (k = i; k < N; k++) sum += count[j * N + k];
		}
		printf("%d\t", sum);
	}
	printf("\n\n");
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count2[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	free(order);
	free(exists);
	free(count);
	free(count2);
	return 0;
}

#endif

/*
そこが加算される操作：取られるところとそこまでに穴がない
その間以外はドントケア
ドントケア→任意の順番で取られるor取られない

↓嘘、続きのクエリの順番も考慮
↓嘘、どこを残すか問題も
0 1 2  3  4   5
1 1 2  6 24 120
1 2 4 10 36 156

#: 加算 t: 取られる *:加算&取られる .:取られてない d:ドントケア

*d : <del>2</del>
#t : 1

↓嘘
*dd : <del>2 + 2 + 1 = 5</del> 2(順番) * 3(いつやるか) = 6
#td : <del>2</del> 1(順番) * 2(いつやるか) = 2
#.t : 1

*dd : 2(順番) * 3(いつやるか) = 6
#td : 1(dt#) + 2(t(#d|d#)) = 3
#.t : 2(tのあとの順番) = 2

d*d : 2(順番) * 3(いつやるか) = 6

*/
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mul
	.type	mul, @function
mul:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mul, .-mul
	.globl	pow_i
	.type	pow_i, @function
pow_i:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-20(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -4(%rbp)
.L5:
	movl	-20(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L4:
	cmpl	$0, -24(%rbp)
	jg	.L6
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	pow_i, .-pow_i
	.globl	inv
	.type	inv, @function
inv:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	$1000000005, %esi
	movl	%eax, %edi
	call	pow_i
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	inv, .-inv
	.globl	div
	.type	div, @function
div:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	inv
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	div, .-div
	.globl	add
	.type	add, @function
add:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jle	.L13
	subl	$1000000007, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	add, .-add
	.globl	sub
	.type	sub, @function
sub:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	je	.L16
	movl	$1000000007, %eax
	subl	-24(%rbp), %eax
	jmp	.L17
.L16:
	movl	$0, %eax
.L17:
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sub, .-sub
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 800000
A:
	.zero	800000
	.globl	mofu
	.align 32
	.type	mofu, @object
	.size	mofu, 1600000
mofu:
	.zero	1600000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	$0, -24(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -32(%rbp)
	jmp	.L22
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -32(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L24
	movl	$1, -28(%rbp)
	movl	$1, -32(%rbp)
	jmp	.L25
.L26:
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L25:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L26
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$0, -32(%rbp)
	jmp	.L27
.L28:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	leal	(%rcx,%rax), %ebx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	div
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %edx
	movslq	%ebx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L28
	movl	$1, -32(%rbp)
	jmp	.L29
.L30:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L29:
	movl	N(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L30
	movl	$0, -32(%rbp)
	jmp	.L31
.L32:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sub
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -24(%rbp)
	addl	$1, -32(%rbp)
.L31:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L32
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	mul
	.type	mul, @function
mul:
.LFB23:
	.cfi_startproc
	endbr64
	movabsq	$-8543223828751151131, %rdx
	movslq	%esi, %rsi
	movslq	%edi, %rdi
	imulq	%rsi, %rdi
	movq	%rdi, %rax
	imulq	%rdx
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%edi, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	mul, .-mul
	.p2align 4
	.globl	pow_i
	.type	pow_i, @function
pow_i:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%esi, %ecx
	movl	$1, %r8d
	testl	%esi, %esi
	jle	.L3
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L5
	movslq	%r8d, %r8
	imulq	%rdi, %r8
	movq	%r8, %rax
	imulq	%rsi
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L5:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	imulq	%rsi
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	sarl	%ecx
	jne	.L6
.L3:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	pow_i, .-pow_i
	.p2align 4
	.globl	inv
	.type	inv, @function
inv:
.LFB25:
	.cfi_startproc
	endbr64
	movl	$30, %esi
	movl	$1, %r9d
	movl	$1000000005, %ecx
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L13
	movslq	%r9d, %r9
	imulq	%rdi, %r9
	movq	%r9, %rax
	imulq	%r8
	movq	%r9, %rax
	sarq	$63, %rax
	addq	%r9, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r9d
.L13:
	imulq	%rdi, %rdi
	sarl	%ecx
	movq	%rdi, %rax
	imulq	%r8
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	subl	$1, %esi
	jne	.L14
	movl	%r9d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	inv, .-inv
	.p2align 4
	.globl	div
	.type	div, @function
div:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	%edi, %r8
	movl	$30, %r9d
	movl	$1, %ecx
	movl	$1000000005, %edi
	movabsq	$-8543223828751151131, %r10
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	%esi, %rsi
	testb	$1, %dil
	je	.L20
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %ecx
.L20:
	imulq	%rsi, %rsi
	sarl	%edi
	movq	%rsi, %rax
	imulq	%r10
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
	subl	$1, %r9d
	jne	.L21
	movslq	%ecx, %rcx
	imulq	%r8, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%ecx, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	div, .-div
	.p2align 4
	.globl	add
	.type	add, @function
add:
.LFB27:
	.cfi_startproc
	endbr64
	leal	(%rdi,%rsi), %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE27:
	.size	add, .-add
	.p2align 4
	.globl	sub
	.type	sub, @function
sub:
.LFB28:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	subl	%esi, %eax
	addl	$1000000007, %eax
	testl	%esi, %esi
	cmove	%edi, %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE28:
	.size	sub, .-sub
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB29:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L38
	movslq	N(%rip), %r10
	testl	%r10d, %r10d
	jle	.L37
	leaq	A(%rip), %rbx
	xorl	%r12d, %r12d
	movq	%rbx, %rbp
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L69:
	movslq	N(%rip), %r10
	addl	$1, %r12d
	addq	$4, %rbp
	cmpl	%r12d, %r10d
	jle	.L68
.L39:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L69
.L38:
	movl	$1, %eax
.L34:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L68:
	.cfi_restore_state
	testl	%r10d, %r10d
	jle	.L37
	leal	1(%r10), %r13d
	movl	$1, %esi
	movabsq	$-8543223828751151131, %rdi
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%eax, %rcx
	imulq	%rsi, %rcx
	addq	$1, %rsi
	movq	%rcx, %rax
	imulq	%rdi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	movslq	%ecx, %rax
	cmpq	%r13, %rsi
	jne	.L40
	movslq	%r10d, %r14
	leaq	mofu(%rip), %rbp
	movl	%r10d, 12(%rsp)
	movq	%rax, %r10
	movl	%ecx, 0(%rbp,%r14,4)
	leaq	0(%rbp,%r14,4), %r15
	movl	$1, %r11d
	movabsq	$-8543223828751151131, %r9
	movq	%r15, %r12
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%r11d, %ecx
	movl	$1, %esi
	movl	$30, %r8d
	movl	$1000000005, %edi
	.p2align 4,,10
	.p2align 3
.L43:
	movslq	%ecx, %rcx
	testb	$1, %dil
	je	.L42
	movslq	%esi, %rsi
	imulq	%rcx, %rsi
	movq	%rsi, %rax
	imulq	%r9
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
.L42:
	imulq	%rcx, %rcx
	sarl	%edi
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %ecx
	subl	$1, %r8d
	jne	.L43
	movslq	%esi, %rsi
	subq	$4, %r12
	imulq	%r10, %rsi
	movq	%rsi, %rax
	imulq	%r9
	leaq	(%rdx,%rsi), %rax
	movq	%rsi, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rsi
	movl	%esi, -4(%r15,%r11,4)
	addq	$1, %r11
	movl	%esi, 4(%r12)
	cmpq	%r11, %r13
	jne	.L44
	movl	12(%rsp), %r10d
	movl	mofu(%rip), %eax
	movl	$1, %edx
	addl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L47:
	addl	0(%rbp,%rdx,4), %eax
	cmpl	$1000000006, %eax
	leal	-1000000007(%rax), %ecx
	cmovg	%ecx, %eax
	movl	%eax, 0(%rbp,%rdx,4)
	addq	$1, %rdx
	cmpl	%edx, %r10d
	jge	.L47
	leaq	0(%rbp,%r14,4), %r9
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1000000007, %edi
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L51:
	movl	0(%rbp,%rcx,4), %eax
	movl	(%r9,%rcx,4), %edx
	movl	%edi, %r11d
	subl	%eax, %r11d
	movl	%edx, %r10d
	addl	%r11d, %edx
	testl	%eax, %eax
	cmove	%r10d, %edx
	movslq	(%rbx,%rcx,4), %r10
	cmpl	$1000000006, %edx
	leal	-1000000007(%rdx), %eax
	cmovg	%eax, %edx
	movslq	%edx, %rdx
	imulq	%rdx, %r10
	movq	%r10, %rax
	imulq	%rsi
	movq	%r10, %rax
	sarq	$63, %rax
	addq	%r10, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %r10
	addl	%r10d, %r8d
	cmpl	$1000000006, %r8d
	leal	-1000000007(%r8), %eax
	cmovg	%eax, %r8d
	addq	$1, %rcx
	cmpq	%r14, %rcx
	jne	.L51
.L52:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L34
.L37:
	leaq	mofu(%rip), %rax
	xorl	%r8d, %r8d
	movl	$1, (%rax,%r10,4)
	jmp	.L52
	.cfi_endproc
.LFE29:
	.size	main, .-main
	.globl	mofu
	.bss
	.align 32
	.type	mofu, @object
	.size	mofu, 1600000
mofu:
	.zero	1600000
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 800000
A:
	.zero	800000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	mul
	.type	mul, @function
mul:
.LFB23:
	.cfi_startproc
	endbr64
	movabsq	$-8543223828751151131, %rdx
	movslq	%esi, %rsi
	movslq	%edi, %rdi
	imulq	%rsi, %rdi
	movq	%rdi, %rax
	imulq	%rdx
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%edi, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	mul, .-mul
	.p2align 4
	.globl	pow_i
	.type	pow_i, @function
pow_i:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%esi, %ecx
	movl	$1, %r8d
	testl	%esi, %esi
	jle	.L3
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L5
	movslq	%r8d, %r8
	imulq	%rdi, %r8
	movq	%r8, %rax
	imulq	%rsi
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L5:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	imulq	%rsi
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	sarl	%ecx
	jne	.L6
.L3:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	pow_i, .-pow_i
	.p2align 4
	.globl	inv
	.type	inv, @function
inv:
.LFB25:
	.cfi_startproc
	endbr64
	movl	$30, %esi
	movl	$1, %r9d
	movl	$1000000005, %ecx
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L13
	movslq	%r9d, %r9
	imulq	%rdi, %r9
	movq	%r9, %rax
	imulq	%r8
	movq	%r9, %rax
	sarq	$63, %rax
	addq	%r9, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r9d
.L13:
	imulq	%rdi, %rdi
	sarl	%ecx
	movq	%rdi, %rax
	imulq	%r8
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	subl	$1, %esi
	jne	.L14
	movl	%r9d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	inv, .-inv
	.p2align 4
	.globl	div
	.type	div, @function
div:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	%edi, %r8
	movl	$30, %r9d
	movl	$1, %ecx
	movl	$1000000005, %edi
	movabsq	$-8543223828751151131, %r10
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	%esi, %rsi
	testb	$1, %dil
	je	.L20
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %ecx
.L20:
	imulq	%rsi, %rsi
	sarl	%edi
	movq	%rsi, %rax
	imulq	%r10
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
	subl	$1, %r9d
	jne	.L21
	movslq	%ecx, %rcx
	imulq	%r8, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%ecx, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	div, .-div
	.p2align 4
	.globl	add
	.type	add, @function
add:
.LFB27:
	.cfi_startproc
	endbr64
	leal	(%rdi,%rsi), %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE27:
	.size	add, .-add
	.p2align 4
	.globl	sub
	.type	sub, @function
sub:
.LFB28:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	subl	%esi, %eax
	addl	$1000000007, %eax
	testl	%esi, %esi
	cmove	%edi, %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE28:
	.size	sub, .-sub
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB29:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L38
	movslq	N(%rip), %r10
	testl	%r10d, %r10d
	jle	.L37
	leaq	A(%rip), %rbx
	xorl	%r12d, %r12d
	movq	%rbx, %rbp
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L69:
	movslq	N(%rip), %r10
	addl	$1, %r12d
	addq	$4, %rbp
	cmpl	%r12d, %r10d
	jle	.L68
.L39:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L69
.L38:
	movl	$1, %eax
.L34:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L68:
	.cfi_restore_state
	testl	%r10d, %r10d
	jle	.L37
	leal	1(%r10), %r13d
	movl	$1, %esi
	movabsq	$-8543223828751151131, %rdi
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%eax, %rcx
	imulq	%rsi, %rcx
	addq	$1, %rsi
	movq	%rcx, %rax
	imulq	%rdi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	movslq	%ecx, %rax
	cmpq	%r13, %rsi
	jne	.L40
	movslq	%r10d, %r14
	leaq	mofu(%rip), %rbp
	movl	%r10d, 12(%rsp)
	movq	%rax, %r10
	movl	%ecx, 0(%rbp,%r14,4)
	leaq	0(%rbp,%r14,4), %r15
	movl	$1, %r11d
	movabsq	$-8543223828751151131, %r9
	movq	%r15, %r12
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%r11d, %ecx
	movl	$1, %esi
	movl	$30, %r8d
	movl	$1000000005, %edi
	.p2align 4,,10
	.p2align 3
.L43:
	movslq	%ecx, %rcx
	testb	$1, %dil
	je	.L42
	movslq	%esi, %rsi
	imulq	%rcx, %rsi
	movq	%rsi, %rax
	imulq	%r9
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
.L42:
	imulq	%rcx, %rcx
	sarl	%edi
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %ecx
	subl	$1, %r8d
	jne	.L43
	movslq	%esi, %rsi
	subq	$4, %r12
	imulq	%r10, %rsi
	movq	%rsi, %rax
	imulq	%r9
	leaq	(%rdx,%rsi), %rax
	movq	%rsi, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rsi
	movl	%esi, -4(%r15,%r11,4)
	addq	$1, %r11
	movl	%esi, 4(%r12)
	cmpq	%r11, %r13
	jne	.L44
	movl	12(%rsp), %r10d
	movl	mofu(%rip), %eax
	movl	$1, %edx
	addl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L47:
	addl	0(%rbp,%rdx,4), %eax
	cmpl	$1000000006, %eax
	leal	-1000000007(%rax), %ecx
	cmovg	%ecx, %eax
	movl	%eax, 0(%rbp,%rdx,4)
	addq	$1, %rdx
	cmpl	%edx, %r10d
	jge	.L47
	leaq	0(%rbp,%r14,4), %r9
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1000000007, %edi
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L51:
	movl	0(%rbp,%rcx,4), %eax
	movl	(%r9,%rcx,4), %edx
	movl	%edi, %r11d
	subl	%eax, %r11d
	movl	%edx, %r10d
	addl	%r11d, %edx
	testl	%eax, %eax
	cmove	%r10d, %edx
	movslq	(%rbx,%rcx,4), %r10
	cmpl	$1000000006, %edx
	leal	-1000000007(%rdx), %eax
	cmovg	%eax, %edx
	movslq	%edx, %rdx
	imulq	%rdx, %r10
	movq	%r10, %rax
	imulq	%rsi
	movq	%r10, %rax
	sarq	$63, %rax
	addq	%r10, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %r10
	addl	%r10d, %r8d
	cmpl	$1000000006, %r8d
	leal	-1000000007(%r8), %eax
	cmovg	%eax, %r8d
	addq	$1, %rcx
	cmpq	%r14, %rcx
	jne	.L51
.L52:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L34
.L37:
	leaq	mofu(%rip), %rax
	xorl	%r8d, %r8d
	movl	$1, (%rax,%r10,4)
	jmp	.L52
	.cfi_endproc
.LFE29:
	.size	main, .-main
	.globl	mofu
	.bss
	.align 32
	.type	mofu, @object
	.size	mofu, 1600000
mofu:
	.zero	1600000
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 800000
A:
	.zero	800000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#ifndef ZIKKEN
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY 1000000007

int mul(int a, int b) {
	return (int64_t)a * b % MOD_BY;
}

int pow_i(int a, int n) {
	int r = 1;
	while (n > 0) {
		if (n & 1) r = mul(r, a);
		a = mul(a, a);
		n >>= 1;
	}
	return r;
}

int inv(int a) {
	return pow_i(a, MOD_BY - 2);
}

int div(int a, int b) {
	return mul(a, inv(b));
}

int add(int a, int b) {
	int x = a + b;
	if (x >= MOD_BY) x -= MOD_BY;
	return x;
}

int sub(int a, int b) {
	int x = b == 0 ? 0 : MOD_BY - b;
	return add(a, x);
}

#define MAX 200000

int N;
int A[MAX];

int mofu[MAX * 2];

int main(void) {
	int i;
	int all;
	int result = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	all = 1;
	for (i = 1; i <= N; i++) all = mul(all, i);
	mofu[N] = all;
	for (i = 0; i < N; i++) {
		mofu[N - i] = mofu[N + i] = div(all, i + 1);
	}
	for (i = 1; i <= N + N; i++) mofu[i] = add(mofu[i - 1], mofu[i]);
	for (i = 0; i < N; i++) {
		int ruiseki = sub(mofu[i + N], mofu[i]);
		result = add(result, mul(A[i], ruiseki));
	}
	printf("%d\n", result);
	return 0;
}

/*
s(x, y) = answer for [x, y)
c(x, y) = cost (ruisekiwa) for {x, y)

s(0, 3) = c(0, 3) +
	s(0, 0) + s(1, 3) +
	s(0, 1) + s(2, 3) +
	s(0, 2) + s(3, 3)

s(0, 0) = 0
s(1, 3) = c(1, 3) +
	s(1, 1) + s(2, 3) +
	s(1, 2) + s(3, 3)
s(0, 1) = c(0, 1)
s(2, 3) = c(2, 3)
s(0, 2) = c(0, 2) +
	s(0, 0) + s(1, 2) +
	s(0, 1) + s(2, 2)
s(3, 3) = 0
s(1, 1) = 0
s(1, 2) = c(1, 2)

s(0, 3) = c(0, 3) +
	c(1, 3) + c(2, 3) + c(1, 2) +
	c(0, 1) + c(2, 3) +
	c(0, 2) + c(1, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) + c(1, 3) + c(2, 3) +
	c(0, 3) + c(1, 3) + c(1, 2) +
	c(0, 3) + c(0, 1) + c(2, 3) +
	c(0, 3) + c(2, 3) + c(0, 1) +
	c(0, 3) + c(0, 2) + c(1, 2) +
	c(0, 3) + c(0, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) * 6 +
	c(0, 2) * 2 + c(1, 3) * 2 +
	c(0, 1) * 3 + c(1, 2) * 2 + c(2, 3) * 3

s(0, 2) =
	c(0, 2) + c(1, 2) +
	c(0, 2) + c(0, 1)

s(0, 2) =
	c(0, 2) * 2 +
	c(0, 1) * 1 + c(1, 2) * 1

*/
#else
#include <stdio.h>
#include <stdlib.h>

/* {1,2,3} -> ... -> {3,2,1} */
int next_permutation(int arr[],int n) {
	int target;
	int i;
	int temp;
	for (i = n - 2; i >= 0; i--) {
		if (arr[i] < arr[i + 1]) break;
	}
	if (i < 0) return 0;
	target = i;

	for (i = 0; target + i + 1 < n - i - 1; i++) {
		temp = arr[target + 1 + i];
		arr[target + 1 + i] = arr[n - 1 - i];
		arr[n - i - 1] = temp;
	}

	for (i = target + 1; i < n; i++) {
		if (arr[i] > arr[target]) break;
	}
	temp = arr[i];
	arr[i] = arr[target];
	arr[target] = temp;
	return 1;
}

int main(void) {
	int N;
	int i, j, k;
	int *order;
	char *exists;
	int *count;
	int *count2;
	if (scanf("%d", &N) != 1) return 1;
	if ((order = malloc(sizeof(int) * N)) == NULL) return 1;
	if ((exists = malloc(sizeof(char) * N)) == NULL) {
		free(order);
		return 1;
	}
	if ((count = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		return 1;
	}
	if ((count2 = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		free(count);
		return 1;
	}
	for (i = 0; i < N * N; i++) count[i] = count2[i] = 0;
	for (i = 0; i < N; i++) order[i] = i;
	do {
		for (i = 0; i < N; i++) exists[i] = 1;
		for (i = 0; i < N; i++) {
			int left, right;
			left = right = order[i];
			while (left >= 0 && exists[left]) left--;
			while (right < N && exists[right]) right++;
			count[(left + 1) * N + (right - 1)]++;
			if (0) printf("%d -> %d %d\n", order[i], left + 1, right - 1);
			exists[order[i]] = 0;
			for (j = left + 1; j < right; j++) {
				count2[order[i] * N + j]++;
			}
		}
	} while (next_permutation(order, N));
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	for (i = 0; i < N; i++) {
		int sum = 0;
		for (j = 0; j <= i; j++) {
			for (k = i; k < N; k++) sum += count[j * N + k];
		}
		printf("%d\t", sum);
	}
	printf("\n\n");
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count2[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	free(order);
	free(exists);
	free(count);
	free(count2);
	return 0;
}

#endif

/*
そこが加算される操作：取られるところとそこまでに穴がない
その間以外はドントケア
ドントケア→任意の順番で取られるor取られない

↓嘘、続きのクエリの順番も考慮
↓嘘、どこを残すか問題も
0 1 2  3  4   5
1 1 2  6 24 120
1 2 4 10 36 156

#: 加算 t: 取られる *:加算&取られる .:取られてない d:ドントケア

*d : <del>2</del>
#t : 1

↓嘘
*dd : <del>2 + 2 + 1 = 5</del> 2(順番) * 3(いつやるか) = 6
#td : <del>2</del> 1(順番) * 2(いつやるか) = 2
#.t : 1

*dd : 2(順番) * 3(いつやるか) = 6
#td : 1(dt#) + 2(t(#d|d#)) = 3
#.t : 2(tのあとの順番) = 2

d*d : 2(順番) * 3(いつやるか) = 6

*/

10
1 2 4 8 16 32 64 128 22 512
 2
1 1
 4
1 2 1 1
 10
1 2 4 8 16 32 64 128 21 512
 2
2 1
 4
1 2 2 1
 10
1 2 4 8 20 32 64 128 21 512
 2
2 2
 4
1 2 2 2
 10
1 2 4 8 20 32 89 128 21 512

54214497
 6
 268
 42134337
 9
 324
 96324417
 12
 374
 429828417

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#ifndef ZIKKEN
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY 1000000007

int mul(int a, int b) {
	return (int64_t)a * b % MOD_BY;
}

int pow_i(int a, int n) {
	int r = 1;
	while (n > 0) {
		if (n & 1) r = mul(r, a);
		a = mul(a, a);
		n >>= 1;
	}
	return r;
}

int inv(int a) {
	return pow_i(a, MOD_BY - 2);
}

int div(int a, int b) {
	return mul(a, inv(b));
}

int add(int a, int b) {
	int x = a + b;
	if (x >= MOD_BY) x -= MOD_BY;
	return x;
}

int sub(int a, int b) {
	int x = b == 0 ? 0 : MOD_BY - b;
	return add(a, x);
}

#define MAX 200000

int N;
int A[MAX];

int mofu[MAX * 2];

int main(void) {
	int i;
	int all;
	int result = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	all = 1;
	for (i = 1; i <= N; i++) all = mul(all, i);
	mofu[N] = all;
	for (i = 0; i < N; i++) {
		mofu[N - i] = mofu[N + i] = div(all, i + 1);
	}
	for (i = 1; i <= N + N; i++) mofu[i] = add(mofu[i - 1], mofu[i]);
	for (i = 0; i < N; i++) {
		int ruiseki = sub(mofu[i + N], mofu[i]);
		result = add(result, mul(A[i], ruiseki));
	}
	printf("%d\n", result);
	return 0;
}

/*
s(x, y) = answer for [x, y)
c(x, y) = cost (ruisekiwa) for {x, y)

s(0, 3) = c(0, 3) +
	s(0, 0) + s(1, 3) +
	s(0, 1) + s(2, 3) +
	s(0, 2) + s(3, 3)

s(0, 0) = 0
s(1, 3) = c(1, 3) +
	s(1, 1) + s(2, 3) +
	s(1, 2) + s(3, 3)
s(0, 1) = c(0, 1)
s(2, 3) = c(2, 3)
s(0, 2) = c(0, 2) +
	s(0, 0) + s(1, 2) +
	s(0, 1) + s(2, 2)
s(3, 3) = 0
s(1, 1) = 0
s(1, 2) = c(1, 2)

s(0, 3) = c(0, 3) +
	c(1, 3) + c(2, 3) + c(1, 2) +
	c(0, 1) + c(2, 3) +
	c(0, 2) + c(1, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) + c(1, 3) + c(2, 3) +
	c(0, 3) + c(1, 3) + c(1, 2) +
	c(0, 3) + c(0, 1) + c(2, 3) +
	c(0, 3) + c(2, 3) + c(0, 1) +
	c(0, 3) + c(0, 2) + c(1, 2) +
	c(0, 3) + c(0, 2) + c(0, 1)

s(0, 3) =
	c(0, 3) * 6 +
	c(0, 2) * 2 + c(1, 3) * 2 +
	c(0, 1) * 3 + c(1, 2) * 2 + c(2, 3) * 3

s(0, 2) =
	c(0, 2) + c(1, 2) +
	c(0, 2) + c(0, 1)

s(0, 2) =
	c(0, 2) * 2 +
	c(0, 1) * 1 + c(1, 2) * 1

*/
#else
#include <stdio.h>
#include <stdlib.h>

/* {1,2,3} -> ... -> {3,2,1} */
int next_permutation(int arr[],int n) {
	int target;
	int i;
	int temp;
	for (i = n - 2; i >= 0; i--) {
		if (arr[i] < arr[i + 1]) break;
	}
	if (i < 0) return 0;
	target = i;

	for (i = 0; target + i + 1 < n - i - 1; i++) {
		temp = arr[target + 1 + i];
		arr[target + 1 + i] = arr[n - 1 - i];
		arr[n - i - 1] = temp;
	}

	for (i = target + 1; i < n; i++) {
		if (arr[i] > arr[target]) break;
	}
	temp = arr[i];
	arr[i] = arr[target];
	arr[target] = temp;
	return 1;
}

int main(void) {
	int N;
	int i, j, k;
	int *order;
	char *exists;
	int *count;
	int *count2;
	if (scanf("%d", &N) != 1) return 1;
	if ((order = malloc(sizeof(int) * N)) == NULL) return 1;
	if ((exists = malloc(sizeof(char) * N)) == NULL) {
		free(order);
		return 1;
	}
	if ((count = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		return 1;
	}
	if ((count2 = malloc(sizeof(int) * N * N)) == NULL) {
		free(order);
		free(exists);
		free(count);
		return 1;
	}
	for (i = 0; i < N * N; i++) count[i] = count2[i] = 0;
	for (i = 0; i < N; i++) order[i] = i;
	do {
		for (i = 0; i < N; i++) exists[i] = 1;
		for (i = 0; i < N; i++) {
			int left, right;
			left = right = order[i];
			while (left >= 0 && exists[left]) left--;
			while (right < N && exists[right]) right++;
			count[(left + 1) * N + (right - 1)]++;
			if (0) printf("%d -> %d %d\n", order[i], left + 1, right - 1);
			exists[order[i]] = 0;
			for (j = left + 1; j < right; j++) {
				count2[order[i] * N + j]++;
			}
		}
	} while (next_permutation(order, N));
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	for (i = 0; i < N; i++) {
		int sum = 0;
		for (j = 0; j <= i; j++) {
			for (k = i; k < N; k++) sum += count[j * N + k];
		}
		printf("%d\t", sum);
	}
	printf("\n\n");
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			printf("%d\t", count2[i * N + j]);
		}
		printf("\n");
	}
	printf("\n");
	free(order);
	free(exists);
	free(count);
	free(count2);
	return 0;
}

#endif

/*
そこが加算される操作：取られるところとそこまでに穴がない
その間以外はドントケア
ドントケア→任意の順番で取られるor取られない

↓嘘、続きのクエリの順番も考慮
↓嘘、どこを残すか問題も
0 1 2  3  4   5
1 1 2  6 24 120
1 2 4 10 36 156

#: 加算 t: 取られる *:加算&取られる .:取られてない d:ドントケア

*d : <del>2</del>
#t : 1

↓嘘
*dd : <del>2 + 2 + 1 = 5</del> 2(順番) * 3(いつやるか) = 6
#td : <del>2</del> 1(順番) * 2(いつやるか) = 2
#.t : 1

*dd : 2(順番) * 3(いつやるか) = 6
#td : 1(dt#) + 2(t(#d|d#)) = 3
#.t : 2(tのあとの順番) = 2

d*d : 2(順番) * 3(いつやるか) = 6

*/
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mul
	.type	mul, @function
mul:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mul, .-mul
	.globl	pow_i
	.type	pow_i, @function
pow_i:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-20(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -4(%rbp)
.L5:
	movl	-20(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L4:
	cmpl	$0, -24(%rbp)
	jg	.L6
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	pow_i, .-pow_i
	.globl	inv
	.type	inv, @function
inv:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	$1000000005, %esi
	movl	%eax, %edi
	call	pow_i
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	inv, .-inv
	.globl	div
	.type	div, @function
div:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	inv
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	div, .-div
	.globl	add
	.type	add, @function
add:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jle	.L13
	subl	$1000000007, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	add, .-add
	.globl	sub
	.type	sub, @function
sub:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	je	.L16
	movl	$1000000007, %eax
	subl	-24(%rbp), %eax
	jmp	.L17
.L16:
	movl	$0, %eax
.L17:
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sub, .-sub
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 800000
A:
	.zero	800000
	.globl	mofu
	.align 32
	.type	mofu, @object
	.size	mofu, 1600000
mofu:
	.zero	1600000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	$0, -24(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -32(%rbp)
	jmp	.L22
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -32(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L24
	movl	$1, -28(%rbp)
	movl	$1, -32(%rbp)
	jmp	.L25
.L26:
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L25:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L26
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$0, -32(%rbp)
	jmp	.L27
.L28:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	leal	(%rcx,%rax), %ebx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	div
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %edx
	movslq	%ebx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L28
	movl	$1, -32(%rbp)
	jmp	.L29
.L30:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L29:
	movl	N(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L30
	movl	$0, -32(%rbp)
	jmp	.L31
.L32:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sub
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -24(%rbp)
	addl	$1, -32(%rbp)
.L31:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L32
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	mul
	.type	mul, @function
mul:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mul, .-mul
	.globl	pow_i
	.type	pow_i, @function
pow_i:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-20(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -4(%rbp)
.L5:
	movl	-20(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L4:
	cmpl	$0, -24(%rbp)
	jg	.L6
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	pow_i, .-pow_i
	.globl	inv
	.type	inv, @function
inv:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	$1000000005, %esi
	movl	%eax, %edi
	call	pow_i
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	inv, .-inv
	.globl	div
	.type	div, @function
div:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$8, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	inv
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	div, .-div
	.globl	add
	.type	add, @function
add:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jle	.L13
	subl	$1000000007, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	add, .-add
	.globl	sub
	.type	sub, @function
sub:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$24, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	je	.L16
	movl	$1000000007, %eax
	subl	-24(%rbp), %eax
	jmp	.L17
.L16:
	movl	$0, %eax
.L17:
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sub, .-sub
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 800000
A:
	.zero	800000
	.globl	mofu
	.align 32
	.type	mofu, @object
	.size	mofu, 1600000
mofu:
	.zero	1600000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	$0, -24(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -32(%rbp)
	jmp	.L22
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -32(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L24
	movl	$1, -28(%rbp)
	movl	$1, -32(%rbp)
	jmp	.L25
.L26:
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L25:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L26
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$0, -32(%rbp)
	jmp	.L27
.L28:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	leal	(%rcx,%rax), %ebx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	div
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %edx
	movslq	%ebx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L28
	movl	$1, -32(%rbp)
	jmp	.L29
.L30:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	mofu(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L29:
	movl	N(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L30
	movl	$0, -32(%rbp)
	jmp	.L31
.L32:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mofu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %ecx
	movl	-32(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mofu(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sub
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -24(%rbp)
	addl	$1, -32(%rbp)
.L31:
	movl	N(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L32
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
