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

```c
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define MOD 10000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define revrep(i,n) for(ll i=n;i>0;i--)

typedef long long ll;

ll fac[100001], inv[100001];

ll mygcd(ll a, ll b) { if (b == 0) return a; return mygcd(b, a % b); }

ll mylcm(ll a, ll b) { return a / mygcd(a, b) * b; }

ll mymax(ll a, ll b) { return (a > b) ? a : b; }

ll mymin(ll a, ll b) { return (a < b) ? a : b; }

int myasc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

int mydsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

ll mypow(ll a, ll b) {
	ll x;
	if (b == 0) return 1;
	else if (b % 2 == 1) return a * mypow(a, b - 1) % MOD;
	x = mypow(a, b / 2);
	return x * x % MOD;
}

ll mycomb(ll a, ll b) {
	if (a < b || a < 0 || b < 0)return 0;
	return fac[a] * inv[a - b] * inv[b] % MOD;
}

int main() {
	bool flag = false;
	ll n,a[81],sum=1000,min;
	scanf("%lld", &n);
	rep(i, n) scanf("%lld", &a[i]);
  	min=a[0];
	rep(i, n-1) {
		if (a[i] > a[i + 1]) {
			sum += sum / min * (a[i] - min);
			min = a[i + 1];
		}
      	else if(i==n-2) sum+=sum / min * (a[n-1] - min);
	}
	printf("%lld", sum);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	fac
	.bss
	.align 32
	.type	fac, @object
	.size	fac, 800008
fac:
	.zero	800008
	.globl	inv
	.align 32
	.type	inv, @object
	.size	inv, 800008
inv:
	.zero	800008
	.text
	.globl	mygcd
	.type	mygcd, @function
mygcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygcd, .-mygcd
	.globl	mylcm
	.type	mylcm, @function
mylcm:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mylcm, .-mylcm
	.globl	mymax
	.type	mymax, @function
mymax:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	mymax, .-mymax
	.globl	mymin
	.type	mymin, @function
mymin:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	mymin, .-mymin
	.globl	myasc
	.type	myasc, @function
myasc:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	myasc, .-myasc
	.globl	mydsc
	.type	mydsc, @function
mydsc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	mydsc, .-mydsc
	.globl	mypow
	.type	mypow, @function
mypow:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L15
	movl	$1, %eax
	jmp	.L16
.L15:
	movq	-32(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L17
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	imulq	-24(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L17:
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	mypow, .-mypow
	.globl	mycomb
	.type	mycomb, @function
mycomb:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jl	.L19
	cmpq	$0, -8(%rbp)
	js	.L19
	cmpq	$0, -16(%rbp)
	jns	.L20
.L19:
	movl	$0, %eax
	jmp	.L21
.L20:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	fac(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	subq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	mycomb, .-mycomb
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -697(%rbp)
	movq	$1000, -688(%rbp)
	leaq	-696(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -672(%rbp)
	jmp	.L23
.L24:
	leaq	-656(%rbp), %rdx
	movq	-672(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -672(%rbp)
.L23:
	movq	-696(%rbp), %rax
	cmpq	%rax, -672(%rbp)
	jl	.L24
	movq	-656(%rbp), %rax
	movq	%rax, -680(%rbp)
	movq	$0, -664(%rbp)
	jmp	.L25
.L28:
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rdx
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L26
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	movq	%rax, -680(%rbp)
	jmp	.L27
.L26:
	movq	-696(%rbp), %rax
	subq	$2, %rax
	cmpq	%rax, -664(%rbp)
	jne	.L27
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-696(%rbp), %rax
	subq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
.L27:
	addq	$1, -664(%rbp)
.L25:
	movq	-696(%rbp), %rax
	subq	$1, %rax
	cmpq	%rax, -664(%rbp)
	jl	.L28
	movq	-688(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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	mygcd
	.type	mygcd, @function
mygcd:
.LFB53:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %r8
.L2:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE53:
	.size	mygcd, .-mygcd
	.p2align 4
	.globl	mylcm
	.type	mylcm, @function
mylcm:
.LFB54:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rcx
	testq	%rsi, %rsi
	jne	.L13
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L16
	movq	%rdi, %rax
	cqto
	idivq	%rcx
	imulq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	mylcm, .-mylcm
	.p2align 4
	.globl	mymax
	.type	mymax, @function
mymax:
.LFB55:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovge	%rsi, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	mymax, .-mymax
	.p2align 4
	.globl	mymin
	.type	mymin, @function
mymin:
.LFB56:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE56:
	.size	mymin, .-mymin
	.p2align 4
	.globl	myasc
	.type	myasc, @function
myasc:
.LFB57:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE57:
	.size	myasc, .-myasc
	.p2align 4
	.globl	mydsc
	.type	mydsc, @function
mydsc:
.LFB58:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE58:
	.size	mydsc, .-mydsc
	.p2align 4
	.globl	mypow
	.type	mypow, @function
mypow:
.LFB59:
	.cfi_startproc
	endbr64
	movl	$1, %eax
	testq	%rsi, %rsi
	je	.L46
	movq	%rsi, %rcx
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	shrq	$63, %rcx
	leaq	(%rsi,%rcx), %rdx
	andl	$1, %edx
	subq	%rcx, %rdx
	cmpq	$1, %rdx
	movq	%rsi, %rdx
	je	.L50
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rsi
	sarq	%rsi
	je	.L23
	shrq	$63, %rdx
	leaq	(%rsi,%rdx), %rcx
	andl	$1, %ecx
	subq	%rdx, %rcx
	cmpq	$1, %rcx
	je	.L51
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rsi
	sarq	%rsi
	je	.L23
	shrq	$63, %rdx
	leaq	(%rsi,%rdx), %rcx
	andl	$1, %ecx
	subq	%rdx, %rcx
	cmpq	$1, %rcx
	je	.L52
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rcx
	sarq	%rcx
	je	.L23
	shrq	$63, %rdx
	leaq	(%rcx,%rdx), %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	je	.L53
	movq	%rcx, %rsi
	shrq	$63, %rsi
	addq	%rcx, %rsi
	sarq	%rsi
	call	mypow
	movabsq	$-2972504414610059549, %rsi
	imulq	%rax, %rax
	movq	%rax, %rcx
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	movq	%rdx, %rax
	shrq	$23, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L23:
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore 6
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	subq	$1, %rdx
	je	.L26
	movq	%rdx, %rcx
	shrq	$63, %rcx
	leaq	(%rdx,%rcx), %rax
	andl	$1, %eax
	subq	%rcx, %rax
	cmpq	$1, %rax
	je	.L54
	movq	%rdx, %rsi
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	call	mypow
	movabsq	$-2972504414610059549, %rdx
	imulq	%rax, %rax
	movq	%rax, %rcx
	mulq	%rdx
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rcx, %rbp
.L26:
	movabsq	$3868559914774873017, %rdx
	movq	%rbp, %rax
	imulq	%rdx
	movq	%rdx, %rax
	movq	%rbp, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rbp, %rax
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L51:
	.cfi_restore_state
	subq	$1, %rsi
	call	mypow
	movq	%rbp, %rcx
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rdx, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L52:
	.cfi_restore_state
	subq	$1, %rsi
	call	mypow
	movq	%rbp, %rcx
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	movq	%rcx, %rdi
	imulq	%rsi
	sarq	$63, %rdi
	sarq	$21, %rdx
	movq	%rdx, %rax
	subq	%rdi, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
.L49:
	imulq	%rsi
	movq	%rcx, %rsi
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	sarq	$63, %rsi
	sarq	$21, %rdx
	movq	%rdx, %rax
	subq	%rsi, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L53:
	.cfi_restore_state
	leaq	-1(%rcx), %rsi
	call	mypow
	movq	%rbp, %rcx
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L54:
	subq	$2, %rsi
	call	mypow
	movabsq	$3868559914774873017, %rdx
	imulq	%rbp, %rax
	movq	%rax, %rcx
	imulq	%rdx
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rcx, %rbp
	jmp	.L26
	.cfi_endproc
.LFE59:
	.size	mypow, .-mypow
	.p2align 4
	.globl	mycomb
	.type	mycomb, @function
mycomb:
.LFB60:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testq	%rsi, %rsi
	cmovns	%rsi, %rax
	cmpq	%rax, %rdi
	jl	.L57
	testq	%rsi, %rsi
	js	.L57
	movq	%rdi, %rdx
	leaq	inv(%rip), %rax
	subq	%rsi, %rdx
	movq	(%rax,%rdx,8), %rcx
	leaq	fac(%rip), %rdx
	imulq	(%rdx,%rdi,8), %rcx
	movabsq	$3868559914774873017, %rdx
	imulq	(%rax,%rsi,8), %rcx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE60:
	.size	mycomb, .-mycomb
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB61:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$672, %rsp
	.cfi_def_cfa_offset 704
	movq	%fs:40, %rax
	movq	%rax, 664(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	testq	%rax, %rax
	jle	.L59
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	addq	$8, %rbp
	cmpq	%rbx, %rax
	jg	.L60
.L59:
	leaq	-1(%rax), %r11
	movq	16(%rsp), %rsi
	testq	%r11, %r11
	jle	.L66
	movq	%rsi, %r10
	xorl	%ecx, %ecx
	leaq	16(%rsp), %rbx
	movl	$1000, %r9d
	leaq	-2(%rax), %r8
	jmp	.L64
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r9, %rax
	subq	%r10, %rdi
	cqto
	idivq	%r10
	movq	%rsi, %r10
	imulq	%rdi, %rax
	addq	%rax, %r9
.L63:
	addq	$1, %rcx
	cmpq	%r11, %rcx
	je	.L61
.L64:
	movq	%rsi, %rdi
	movq	8(%rbx,%rcx,8), %rsi
	cmpq	%rdi, %rsi
	jl	.L70
	cmpq	%rcx, %r8
	jne	.L63
	movq	%r9, %rax
	movq	16(%rsp,%r11,8), %rdi
	addq	$1, %rcx
	cqto
	idivq	%r10
	subq	%r10, %rdi
	imulq	%rax, %rdi
	addq	%rdi, %r9
	cmpq	%r11, %rcx
	jne	.L64
	.p2align 4,,10
	.p2align 3
.L61:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	664(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L71
	addq	$672, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L66:
	.cfi_restore_state
	movl	$1000, %r9d
	jmp	.L61
.L71:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE61:
	.size	main, .-main
	.globl	inv
	.bss
	.align 32
	.type	inv, @object
	.size	inv, 800008
inv:
	.zero	800008
	.globl	fac
	.align 32
	.type	fac, @object
	.size	fac, 800008
fac:
	.zero	800008
	.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	mygcd
	.type	mygcd, @function
mygcd:
.LFB53:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %r8
.L2:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE53:
	.size	mygcd, .-mygcd
	.p2align 4
	.globl	mylcm
	.type	mylcm, @function
mylcm:
.LFB54:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rcx
	testq	%rsi, %rsi
	jne	.L13
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L16
	movq	%rdi, %rax
	cqto
	idivq	%rcx
	imulq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	mylcm, .-mylcm
	.p2align 4
	.globl	mymax
	.type	mymax, @function
mymax:
.LFB55:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovge	%rsi, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	mymax, .-mymax
	.p2align 4
	.globl	mymin
	.type	mymin, @function
mymin:
.LFB56:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE56:
	.size	mymin, .-mymin
	.p2align 4
	.globl	myasc
	.type	myasc, @function
myasc:
.LFB57:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE57:
	.size	myasc, .-myasc
	.p2align 4
	.globl	mydsc
	.type	mydsc, @function
mydsc:
.LFB58:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE58:
	.size	mydsc, .-mydsc
	.p2align 4
	.globl	mypow
	.type	mypow, @function
mypow:
.LFB59:
	.cfi_startproc
	endbr64
	movl	$1, %eax
	testq	%rsi, %rsi
	je	.L46
	movq	%rsi, %rcx
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	shrq	$63, %rcx
	leaq	(%rsi,%rcx), %rdx
	andl	$1, %edx
	subq	%rcx, %rdx
	cmpq	$1, %rdx
	movq	%rsi, %rdx
	je	.L50
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rsi
	sarq	%rsi
	je	.L23
	shrq	$63, %rdx
	leaq	(%rsi,%rdx), %rcx
	andl	$1, %ecx
	subq	%rdx, %rcx
	cmpq	$1, %rcx
	je	.L51
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rsi
	sarq	%rsi
	je	.L23
	shrq	$63, %rdx
	leaq	(%rsi,%rdx), %rcx
	andl	$1, %ecx
	subq	%rdx, %rcx
	cmpq	$1, %rcx
	je	.L52
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rsi, %rdx
	movq	%rdx, %rcx
	sarq	%rcx
	je	.L23
	shrq	$63, %rdx
	leaq	(%rcx,%rdx), %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	je	.L53
	movq	%rcx, %rsi
	shrq	$63, %rsi
	addq	%rcx, %rsi
	sarq	%rsi
	call	mypow
	movabsq	$-2972504414610059549, %rsi
	imulq	%rax, %rax
	movq	%rax, %rcx
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%rsi
	movq	%rdx, %rax
	shrq	$23, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L23:
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore 6
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	subq	$1, %rdx
	je	.L26
	movq	%rdx, %rcx
	shrq	$63, %rcx
	leaq	(%rdx,%rcx), %rax
	andl	$1, %eax
	subq	%rcx, %rax
	cmpq	$1, %rax
	je	.L54
	movq	%rdx, %rsi
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	call	mypow
	movabsq	$-2972504414610059549, %rdx
	imulq	%rax, %rax
	movq	%rax, %rcx
	mulq	%rdx
	shrq	$23, %rdx
	imulq	$10000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rcx, %rbp
.L26:
	movabsq	$3868559914774873017, %rdx
	movq	%rbp, %rax
	imulq	%rdx
	movq	%rdx, %rax
	movq	%rbp, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rbp, %rax
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L51:
	.cfi_restore_state
	subq	$1, %rsi
	call	mypow
	movq	%rbp, %rcx
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rdx, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L52:
	.cfi_restore_state
	subq	$1, %rsi
	call	mypow
	movq	%rbp, %rcx
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	movq	%rcx, %rdi
	imulq	%rsi
	sarq	$63, %rdi
	sarq	$21, %rdx
	movq	%rdx, %rax
	subq	%rdi, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
.L49:
	imulq	%rsi
	movq	%rcx, %rsi
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	sarq	$63, %rsi
	sarq	$21, %rdx
	movq	%rdx, %rax
	subq	%rsi, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L53:
	.cfi_restore_state
	leaq	-1(%rcx), %rsi
	call	mypow
	movq	%rbp, %rcx
	movabsq	$3868559914774873017, %rsi
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rax
	subq	%rax, %rcx
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L54:
	subq	$2, %rsi
	call	mypow
	movabsq	$3868559914774873017, %rdx
	imulq	%rbp, %rax
	movq	%rax, %rcx
	imulq	%rdx
	movq	%rcx, %rax
	sarq	$63, %rax
	sarq	$21, %rdx
	subq	%rax, %rdx
	imulq	$10000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rcx, %rbp
	jmp	.L26
	.cfi_endproc
.LFE59:
	.size	mypow, .-mypow
	.p2align 4
	.globl	mycomb
	.type	mycomb, @function
mycomb:
.LFB60:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testq	%rsi, %rsi
	cmovns	%rsi, %rax
	cmpq	%rax, %rdi
	jl	.L57
	testq	%rsi, %rsi
	js	.L57
	movq	%rdi, %rdx
	leaq	inv(%rip), %rax
	subq	%rsi, %rdx
	movq	(%rax,%rdx,8), %rcx
	leaq	fac(%rip), %rdx
	imulq	(%rdx,%rdi,8), %rcx
	movabsq	$3868559914774873017, %rdx
	imulq	(%rax,%rsi,8), %rcx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$21, %rax
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE60:
	.size	mycomb, .-mycomb
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB61:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$672, %rsp
	.cfi_def_cfa_offset 704
	movq	%fs:40, %rax
	movq	%rax, 664(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	testq	%rax, %rax
	jle	.L59
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	addq	$8, %rbp
	cmpq	%rbx, %rax
	jg	.L60
.L59:
	leaq	-1(%rax), %r11
	movq	16(%rsp), %rsi
	testq	%r11, %r11
	jle	.L66
	movq	%rsi, %r10
	xorl	%ecx, %ecx
	leaq	16(%rsp), %rbx
	movl	$1000, %r9d
	leaq	-2(%rax), %r8
	jmp	.L64
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r9, %rax
	subq	%r10, %rdi
	cqto
	idivq	%r10
	movq	%rsi, %r10
	imulq	%rdi, %rax
	addq	%rax, %r9
.L63:
	addq	$1, %rcx
	cmpq	%r11, %rcx
	je	.L61
.L64:
	movq	%rsi, %rdi
	movq	8(%rbx,%rcx,8), %rsi
	cmpq	%rdi, %rsi
	jl	.L70
	cmpq	%rcx, %r8
	jne	.L63
	movq	%r9, %rax
	movq	16(%rsp,%r11,8), %rdi
	addq	$1, %rcx
	cqto
	idivq	%r10
	subq	%r10, %rdi
	imulq	%rax, %rdi
	addq	%rdi, %r9
	cmpq	%r11, %rcx
	jne	.L64
	.p2align 4,,10
	.p2align 3
.L61:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	664(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L71
	addq	$672, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L66:
	.cfi_restore_state
	movl	$1000, %r9d
	jmp	.L61
.L71:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE61:
	.size	main, .-main
	.globl	inv
	.bss
	.align 32
	.type	inv, @object
	.size	inv, 800008
inv:
	.zero	800008
	.globl	fac
	.align 32
	.type	fac, @object
	.size	fac, 800008
fac:
	.zero	800008
	.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:

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define MOD 10000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define revrep(i,n) for(ll i=n;i>0;i--)

typedef long long ll;

ll fac[100001], inv[100001];

ll mygcd(ll a, ll b) { if (b == 0) return a; return mygcd(b, a % b); }

ll mylcm(ll a, ll b) { return a / mygcd(a, b) * b; }

ll mymax(ll a, ll b) { return (a > b) ? a : b; }

ll mymin(ll a, ll b) { return (a < b) ? a : b; }

int myasc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

int mydsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

ll mypow(ll a, ll b) {
	ll x;
	if (b == 0) return 1;
	else if (b % 2 == 1) return a * mypow(a, b - 1) % MOD;
	x = mypow(a, b / 2);
	return x * x % MOD;
}

ll mycomb(ll a, ll b) {
	if (a < b || a < 0 || b < 0)return 0;
	return fac[a] * inv[a - b] * inv[b] % MOD;
}

int main() {
	bool flag = false;
	ll n,a[81],sum=1000,min;
	scanf("%lld", &n);
	rep(i, n) scanf("%lld", &a[i]);
  	min=a[0];
	rep(i, n-1) {
		if (a[i] > a[i + 1]) {
			sum += sum / min * (a[i] - min);
			min = a[i + 1];
		}
      	else if(i==n-2) sum+=sum / min * (a[n-1] - min);
	}
	printf("%lld", sum);

	return 0;
}
2
157 145
 7
100 130 243 130 115 115 150
 6
200 237 160 140 120 100
 2
157 218
 7
100 130 243 130 115 115 271
 6
200 237 160 233 120 100
 2
103 218
 7
110 130 243 130 115 115 271
 7
110 130 136 130 115 115 271
 6
200 237 119 233 121 100

1000 3165 1185 1366 5706 1696 2035 5161 2794 2211
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define MOD 10000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define revrep(i,n) for(ll i=n;i>0;i--)

typedef long long ll;

ll fac[100001], inv[100001];

ll mygcd(ll a, ll b) { if (b == 0) return a; return mygcd(b, a % b); }

ll mylcm(ll a, ll b) { return a / mygcd(a, b) * b; }

ll mymax(ll a, ll b) { return (a > b) ? a : b; }

ll mymin(ll a, ll b) { return (a < b) ? a : b; }

int myasc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

int mydsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

ll mypow(ll a, ll b) {
	ll x;
	if (b == 0) return 1;
	else if (b % 2 == 1) return a * mypow(a, b - 1) % MOD;
	x = mypow(a, b / 2);
	return x * x % MOD;
}

ll mycomb(ll a, ll b) {
	if (a < b || a < 0 || b < 0)return 0;
	return fac[a] * inv[a - b] * inv[b] % MOD;
}

int main() {
	bool flag = false;
	ll n,a[81],sum=1000,min;
	scanf("%lld", &n);
	rep(i, n) scanf("%lld", &a[i]);
  	min=a[0];
	rep(i, n-1) {
		if (a[i] > a[i + 1]) {
			sum += sum / min * (a[i] - min);
			min = a[i + 1];
		}
      	else if(i==n-2) sum+=sum / min * (a[n-1] - min);
	}
	printf("%lld", sum);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	fac
	.bss
	.align 32
	.type	fac, @object
	.size	fac, 800008
fac:
	.zero	800008
	.globl	inv
	.align 32
	.type	inv, @object
	.size	inv, 800008
inv:
	.zero	800008
	.text
	.globl	mygcd
	.type	mygcd, @function
mygcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygcd, .-mygcd
	.globl	mylcm
	.type	mylcm, @function
mylcm:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mylcm, .-mylcm
	.globl	mymax
	.type	mymax, @function
mymax:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	mymax, .-mymax
	.globl	mymin
	.type	mymin, @function
mymin:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	mymin, .-mymin
	.globl	myasc
	.type	myasc, @function
myasc:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	myasc, .-myasc
	.globl	mydsc
	.type	mydsc, @function
mydsc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	mydsc, .-mydsc
	.globl	mypow
	.type	mypow, @function
mypow:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L15
	movl	$1, %eax
	jmp	.L16
.L15:
	movq	-32(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L17
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	imulq	-24(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L17:
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	mypow, .-mypow
	.globl	mycomb
	.type	mycomb, @function
mycomb:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jl	.L19
	cmpq	$0, -8(%rbp)
	js	.L19
	cmpq	$0, -16(%rbp)
	jns	.L20
.L19:
	movl	$0, %eax
	jmp	.L21
.L20:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	fac(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	subq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	mycomb, .-mycomb
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -697(%rbp)
	movq	$1000, -688(%rbp)
	leaq	-696(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -672(%rbp)
	jmp	.L23
.L24:
	leaq	-656(%rbp), %rdx
	movq	-672(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -672(%rbp)
.L23:
	movq	-696(%rbp), %rax
	cmpq	%rax, -672(%rbp)
	jl	.L24
	movq	-656(%rbp), %rax
	movq	%rax, -680(%rbp)
	movq	$0, -664(%rbp)
	jmp	.L25
.L28:
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rdx
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L26
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	movq	%rax, -680(%rbp)
	jmp	.L27
.L26:
	movq	-696(%rbp), %rax
	subq	$2, %rax
	cmpq	%rax, -664(%rbp)
	jne	.L27
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-696(%rbp), %rax
	subq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
.L27:
	addq	$1, -664(%rbp)
.L25:
	movq	-696(%rbp), %rax
	subq	$1, %rax
	cmpq	%rax, -664(%rbp)
	jl	.L28
	movq	-688(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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	fac
	.bss
	.align 32
	.type	fac, @object
	.size	fac, 800008
fac:
	.zero	800008
	.globl	inv
	.align 32
	.type	inv, @object
	.size	inv, 800008
inv:
	.zero	800008
	.text
	.globl	mygcd
	.type	mygcd, @function
mygcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygcd, .-mygcd
	.globl	mylcm
	.type	mylcm, @function
mylcm:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mygcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mylcm, .-mylcm
	.globl	mymax
	.type	mymax, @function
mymax:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	mymax, .-mymax
	.globl	mymin
	.type	mymin, @function
mymin:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	mymin, .-mymin
	.globl	myasc
	.type	myasc, @function
myasc:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	myasc, .-myasc
	.globl	mydsc
	.type	mydsc, @function
mydsc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	mydsc, .-mydsc
	.globl	mypow
	.type	mypow, @function
mypow:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L15
	movl	$1, %eax
	jmp	.L16
.L15:
	movq	-32(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L17
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	imulq	-24(%rbp), %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L17:
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	mypow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	mypow, .-mypow
	.globl	mycomb
	.type	mycomb, @function
mycomb:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jl	.L19
	cmpq	$0, -8(%rbp)
	js	.L19
	cmpq	$0, -16(%rbp)
	jns	.L20
.L19:
	movl	$0, %eax
	jmp	.L21
.L20:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	fac(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	subq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	inv(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$3868559914774873017, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$21, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	mycomb, .-mycomb
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -697(%rbp)
	movq	$1000, -688(%rbp)
	leaq	-696(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -672(%rbp)
	jmp	.L23
.L24:
	leaq	-656(%rbp), %rdx
	movq	-672(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -672(%rbp)
.L23:
	movq	-696(%rbp), %rax
	cmpq	%rax, -672(%rbp)
	jl	.L24
	movq	-656(%rbp), %rax
	movq	%rax, -680(%rbp)
	movq	$0, -664(%rbp)
	jmp	.L25
.L28:
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rdx
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L26
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-664(%rbp), %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
	movq	-664(%rbp), %rax
	addq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	movq	%rax, -680(%rbp)
	jmp	.L27
.L26:
	movq	-696(%rbp), %rax
	subq	$2, %rax
	cmpq	%rax, -664(%rbp)
	jne	.L27
	movq	-688(%rbp), %rax
	cqto
	idivq	-680(%rbp)
	movq	%rax, %rdx
	movq	-696(%rbp), %rax
	subq	$1, %rax
	movq	-656(%rbp,%rax,8), %rax
	subq	-680(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -688(%rbp)
.L27:
	addq	$1, -664(%rbp)
.L25:
	movq	-696(%rbp), %rax
	subq	$1, %rax
	cmpq	%rax, -664(%rbp)
	jl	.L28
	movq	-688(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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:
