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>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int main(){
  long long n,i,j,k,NN=1e6+10,M=1e9+7,pr[1010],r=0,a[100010],b[1010],x,ans=0;
  char p[1000010]={1,1};
  scanf("%lld",&n);
  for(i=2;i*i<NN;i++){
    if(p[i])continue;
    for(j=i*i;j<NN;j+=i)p[j]=1;
  }
  for(i=0;i*i<NN;i++){
    if(p[i])continue;
    pr[r++]=i;
  }
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    x=a[i];
    for(j=0;j<r;j++){
      for(k=0;x%pr[j]==0;k++)x/=pr[j];
      if(b[j]<k)b[j]=k;
    }
    hin(x);
  }
  x=k=N[hout()];
  for(i=1;i<n;i++){
    j=N[hout()];
    if(x==j)continue;
    k=(k*j)%M;
    x=j;
  }
  for(i=0;i<r;i++){
    for(j=0;j<b[i];j++)k=(k*pr[i])%M;
  }
  //printf("%lld\n",k);
  //for(i=0;i<n;i++)printf("%lld\n",k*inv(a[i],M));
  for(i=0;i<n;i++)ans=(ans+(k*inv(a[i],M)%M))%M;
  printf("%lld\n",ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	R
	.data
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.long	1
	.globl	C
	.align 4
	.type	C, @object
	.size	C, 4
C:
	.long	1
	.globl	H
	.bss
	.align 32
	.type	H, @object
	.size	H, 8000040
H:
	.zero	8000040
	.globl	N
	.align 32
	.type	N, @object
	.size	N, 8000040
N:
	.zero	8000040
	.text
	.globl	hyouka
	.type	hyouka, @function
hyouka:
.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	C(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	C(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jg	.L4
	cmpl	$0, -8(%rbp)
	jne	.L5
.L4:
	movl	$0, %eax
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	hyouka, .-hyouka
	.globl	hin
	.type	hin, @function
hin:
.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	C(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, C(%rip)
	movl	%eax, -4(%rbp)
	movl	R(%rip), %eax
	movl	%eax, H(%rip)
	movl	H(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
.L7:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movl	$0, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L8
	movl	R(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, R(%rip)
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hin, .-hin
	.globl	hout
	.type	hout, @function
hout:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	4+H(%rip), %eax
	movl	%eax, -16(%rbp)
	movl	$2, -20(%rbp)
	movl	C(%rip), %eax
	subl	$1, %eax
	movl	%eax, C(%rip)
	movl	C(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -24(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %ebx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L10:
	movl	C(%rip), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hout, .-hout
	.globl	mbk
	.type	mbk, @function
mbk:
.LFB3:
	.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)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	cmpl	$0, -12(%rbp)
	je	.L14
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	movq	%rcx, %rdi
	call	mbk
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	movq	-8(%rbp), %rax
	jmp	.L16
.L15:
	movl	$1, %eax
.L16:
	imulq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	jmp	.L18
.L14:
	movl	$1, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	mbk, .-mbk
	.globl	inv
	.type	inv, @function
inv:
.LFB4:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mbk
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	inv, .-inv
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1814528(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1824, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1000010, -1816288(%rbp)
	movq	$1000000007, -1816280(%rbp)
	movq	$0, -1816312(%rbp)
	movq	$0, -1816296(%rbp)
	movq	$257, -1000032(%rbp)
	movq	$0, -1000024(%rbp)
	leaq	-1000016(%rbp), %rax
	movl	$999994, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1816344(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1816336(%rbp)
	jmp	.L22
.L27:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L51
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -1816328(%rbp)
	jmp	.L25
.L26:
	leaq	-1000032(%rbp), %rdx
	movq	-1816328(%rbp), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movq	-1816336(%rbp), %rax
	addq	%rax, -1816328(%rbp)
.L25:
	movq	-1816328(%rbp), %rax
	cmpq	-1816288(%rbp), %rax
	jl	.L26
	jmp	.L24
.L51:
	nop
.L24:
	addq	$1, -1816336(%rbp)
.L22:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L27
	movq	$0, -1816336(%rbp)
	jmp	.L28
.L31:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L52
	movq	-1816312(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1816312(%rbp)
	movq	-1816336(%rbp), %rdx
	movq	%rdx, -1816272(%rbp,%rax,8)
	jmp	.L30
.L52:
	nop
.L30:
	addq	$1, -1816336(%rbp)
.L28:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L31
	movq	$0, -1816336(%rbp)
	jmp	.L32
.L38:
	leaq	-1800112(%rbp), %rdx
	movq	-1816336(%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
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movq	%rax, -1816304(%rbp)
	movq	$0, -1816328(%rbp)
	jmp	.L33
.L37:
	movq	$0, -1816320(%rbp)
	jmp	.L34
.L35:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, -1816304(%rbp)
	addq	$1, -1816320(%rbp)
.L34:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L35
	movq	-1816328(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816320(%rbp)
	jle	.L36
	movq	-1816328(%rbp), %rax
	movq	-1816320(%rbp), %rdx
	movq	%rdx, -1808192(%rbp,%rax,8)
.L36:
	addq	$1, -1816328(%rbp)
.L33:
	movq	-1816328(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L37
	movq	-1816304(%rbp), %rax
	movl	%eax, %edi
	call	hin
	addq	$1, -1816336(%rbp)
.L32:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L38
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816320(%rbp)
	movq	-1816320(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	movq	$1, -1816336(%rbp)
	jmp	.L39
.L42:
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816328(%rbp)
	movq	-1816304(%rbp), %rax
	cmpq	-1816328(%rbp), %rax
	je	.L53
	movq	-1816320(%rbp), %rax
	imulq	-1816328(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	movq	-1816328(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	jmp	.L41
.L53:
	nop
.L41:
	addq	$1, -1816336(%rbp)
.L39:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L42
	movq	$0, -1816336(%rbp)
	jmp	.L43
.L46:
	movq	$0, -1816328(%rbp)
	jmp	.L44
.L45:
	movq	-1816336(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rax
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	addq	$1, -1816328(%rbp)
.L44:
	movq	-1816336(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816328(%rbp)
	jl	.L45
	addq	$1, -1816336(%rbp)
.L43:
	movq	-1816336(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L46
	movq	$0, -1816336(%rbp)
	jmp	.L47
.L48:
	movq	-1816280(%rbp), %rax
	movl	%eax, %edx
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	inv
	cltq
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	-1816296(%rbp), %rax
	addq	%rdx, %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816296(%rbp)
	addq	$1, -1816336(%rbp)
.L47:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L48
	movq	-1816296(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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	hyouka
	.type	hyouka, @function
hyouka:
.LFB23:
	.cfi_startproc
	endbr64
	movl	C(%rip), %edx
	movl	$1, %eax
	cmpl	%esi, %edx
	jl	.L1
	testl	%esi, %esi
	je	.L4
	cmpl	%edi, %edx
	jl	.L4
	leaq	H(%rip), %rdx
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	movslq	(%rdx,%rdi,4), %rcx
	movslq	(%rdx,%rsi,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rax,%rdx,4), %edx
	cmpl	%edx, (%rax,%rcx,4)
	setl	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE23:
	.size	hyouka, .-hyouka
	.p2align 4
	.globl	hin
	.type	hin, @function
hin:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	C(%rip), %rdx
	movslq	R(%rip), %rax
	movl	%edi, %r10d
	leaq	N(%rip), %r9
	leaq	H(%rip), %rcx
	leal	1(%rdx), %edi
	movl	%eax, H(%rip)
	movq	%rax, %r8
	movl	%edi, C(%rip)
	movl	%r10d, (%r9,%rax,4)
	movl	%edi, %r10d
	shrl	$31, %r10d
.L12:
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %edi
	jl	.L14
	testl	%eax, %eax
	je	.L16
	testb	%r10b, %r10b
	jne	.L16
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
.L18:
	movslq	%eax, %rsi
	movslq	(%rcx), %rbx
	movslq	(%rcx,%rsi,4), %r11
	movq	%r11, %rsi
	movl	(%r9,%r11,4), %r11d
	cmpl	%r11d, (%r9,%rbx,4)
	jge	.L9
.L10:
	movl	%esi, (%rcx,%rdx,4)
	movslq	%eax, %rdx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %edi
	jl	.L8
	testl	%eax, %eax
	je	.L9
	testb	%r10b, %r10b
	je	.L18
.L9:
	leal	1(%r8), %eax
	movl	%r8d, (%rcx,%rdx,4)
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	%eax, R(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore 3
	leal	1(%r8), %eax
	movl	%r8d, (%rcx,%rdx,4)
	movl	%eax, R(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %esi
	movl	%esi, (%rcx,%rdx,4)
	movslq	%eax, %rdx
	jmp	.L12
	.cfi_endproc
.LFE24:
	.size	hin, .-hin
	.p2align 4
	.globl	hout
	.type	hout, @function
hout:
.LFB25:
	.cfi_startproc
	endbr64
	movl	C(%rip), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	H(%rip), %rcx
	movl	4+H(%rip), %r10d
	leal	-1(%rax), %edx
	movl	$1, %eax
	movslq	%edx, %rbx
	movl	%edx, C(%rip)
	movl	(%rcx,%rbx,4), %r11d
	testl	%edx, %edx
	jle	.L21
	movslq	%r11d, %r8
	movslq	%r10d, %rsi
	movl	$2, %eax
	movl	$1, %edi
	leaq	N(%rip), %r9
.L22:
	movl	(%r9,%r8,4), %r8d
	cmpl	%r8d, (%r9,%rsi,4)
	jge	.L30
	leal	(%rdi,%rdi), %eax
	leal	1(%rax), %r8d
	cmpl	%r8d, %edx
	jl	.L23
	cmpl	%eax, %edx
	jl	.L24
	cltq
	movslq	(%rcx,%rax,4), %rsi
	movslq	%r8d, %rax
	movslq	(%rcx,%rax,4), %rax
	movl	(%r9,%rax,4), %eax
	cmpl	%eax, (%r9,%rsi,4)
	movl	%r8d, %eax
	setl	%sil
	movzbl	%sil, %esi
	subl	%esi, %eax
.L23:
	movslq	%eax, %rsi
	movslq	(%rcx,%rsi,4), %rsi
	movl	%esi, (%rcx,%rdi,4)
	cmpl	%eax, %edx
	jl	.L30
	movslq	(%rcx,%rbx,4), %r8
	movslq	%eax, %rdi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L30:
	sarl	%eax
.L21:
	cltq
	movl	%r11d, (%rcx,%rax,4)
	movl	%r10d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movslq	%r8d, %rax
	movslq	(%rcx,%rax,4), %rsi
	movl	%r8d, %eax
	movl	%esi, (%rcx,%rdi,4)
	movslq	%eax, %rdi
	movslq	(%rcx,%rbx,4), %r8
	jmp	.L22
	.cfi_endproc
.LFE25:
	.size	hout, .-hout
	.p2align 4
	.globl	mbk
	.type	mbk, @function
mbk:
.LFB26:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jne	.L58
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L58:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %eax
	movl	%edx, %r8d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrl	$31, %eax
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addl	%esi, %eax
	movslq	%edx, %r13
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	sarl	%eax
	movl	%eax, %r12d
	jne	.L59
.L33:
	andl	$1, %ebx
	je	.L37
	imulq	%rbp, %rdx
.L37:
	movq	%rdx, %rax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	cqto
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	idivq	%r13
	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
	movl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	movq	%rdi, %rax
	imulq	%rdi, %rax
	cqto
	idivq	%r13
	testl	%esi, %esi
	leal	3(%rsi), %eax
	cmovns	%esi, %eax
	sarl	$2, %eax
	movl	%eax, %r14d
	movq	%rdx, %r15
	movl	$1, %edx
	jne	.L60
.L34:
	andl	$1, %r12d
	je	.L36
	imulq	%r15, %rdx
.L36:
	movq	%rdx, %rax
	cqto
	idivq	%r13
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%r15, %rax
	leal	7(%rsi), %esi
	imulq	%r15, %rax
	cqto
	idivq	%r13
	testl	%ebx, %ebx
	cmovns	%ebx, %esi
	sarl	$3, %esi
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%r13
	movq	%rdx, %rdi
	movl	%r8d, %edx
	call	mbk
	andl	$1, %r14d
	cltq
	je	.L35
	movq	8(%rsp), %rcx
	imulq	%rcx, %rax
.L35:
	cqto
	idivq	%r13
	jmp	.L34
	.cfi_endproc
.LFE26:
	.size	mbk, .-mbk
	.p2align 4
	.globl	inv
	.type	inv, @function
inv:
.LFB27:
	.cfi_startproc
	endbr64
	movl	%esi, %r10d
	subl	$2, %r10d
	jne	.L88
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%r10d, %eax
	movslq	%edi, %r9
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	shrl	$31, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	addl	%r10d, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	sarl	%eax
	movl	%eax, %r11d
	jne	.L89
.L63:
	andl	$1, %r10d
	je	.L67
	imulq	%r9, %rdx
.L67:
	movq	%rdx, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	cqto
	idivq	%rbx
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	movl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L89:
	.cfi_restore_state
	movq	%r9, %rax
	imulq	%r9, %rax
	cqto
	idivq	%rbx
	testl	%r10d, %r10d
	leal	1(%rsi), %eax
	cmovns	%r10d, %eax
	sarl	$2, %eax
	movl	%eax, %ebp
	movq	%rdx, %r12
	movl	$1, %edx
	jne	.L90
.L64:
	andl	$1, %r11d
	je	.L66
	imulq	%r12, %rdx
.L66:
	movq	%rdx, %rax
	cqto
	idivq	%rbx
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L90:
	movq	%r12, %rax
	imulq	%r12, %rax
	cqto
	idivq	%rbx
	testl	%r10d, %r10d
	leal	5(%rsi), %eax
	cmovns	%r10d, %eax
	sarl	$3, %eax
	movl	%eax, %r8d
	movq	%rdx, %rax
	movq	%rdx, %r13
	imulq	%rdx, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	%esi, %edx
	movl	%r8d, %esi
	call	mbk
	andl	$1, %ebp
	cltq
	je	.L65
	imulq	%r13, %rax
.L65:
	cqto
	idivq	%rbx
	jmp	.L64
	.cfi_endproc
.LFE27:
	.size	inv, .-inv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-1814528(%rsp), %r11
	.cfi_def_cfa 11, 1814584
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1784, %rsp
	.cfi_def_cfa_offset 1816368
	movl	$999994, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 1816296(%rsp)
	xorl	%eax, %eax
	leaq	816288(%rsp), %rdi
	movq	$257, 816272(%rsp)
	movq	$0, 816280(%rsp)
	call	memset@PLT
	leaq	24(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$2, %edx
	movl	$4, %eax
	leaq	816272(%rsp), %rcx
	jmp	.L93
	.p2align 4,,10
	.p2align 3
.L95:
	addq	$1, %rdx
	movq	%rdx, %rax
	imulq	%rdx, %rax
	cmpq	$1000009, %rax
	jg	.L139
.L93:
	cmpb	$0, (%rcx,%rdx)
	jne	.L95
	.p2align 4,,10
	.p2align 3
.L92:
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpq	$1000009, %rax
	jg	.L95
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpq	$1000009, %rax
	jle	.L92
	jmp	.L95
.L139:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L94:
	cmpb	$0, (%rcx,%rax)
	jne	.L96
	movq	%rax, 32(%rsp,%rbx,8)
	addq	$1, %rbx
.L96:
	addq	$1, %rax
	movq	%rax, %rdx
	imulq	%rax, %rdx
	cmpq	$1000009, %rdx
	jle	.L94
	movq	24(%rsp), %r15
	testq	%r15, %r15
	jle	.L97
	leaq	32(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	16192(%rsp), %rbp
	movq	%rax, (%rsp)
	leaq	(%rax,%rbx,8), %r13
	leaq	8112(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L102:
	movq	%r12, %rdi
	leaq	0(%rbp,%r14,8), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	0(%rbp,%r14,8), %rdi
	testq	%rbx, %rbx
	je	.L98
	movq	8(%rsp), %r11
	movq	(%rsp), %r10
	.p2align 4,,10
	.p2align 3
.L99:
	movq	%rdi, %rax
	movq	(%r10), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rsi
	testq	%rdx, %rdx
	jne	.L140
	.p2align 4,,10
	.p2align 3
.L100:
	movq	%rdi, %rax
	addq	$1, %rsi
	cqto
	idivq	%rcx
	cqto
	movq	%rax, %rdi
	idivq	%rcx
	testq	%rdx, %rdx
	je	.L100
.L101:
	movq	(%r11), %rax
	cmpq	%rsi, %rax
	cmovl	%rsi, %rax
	addq	$8, %r10
	addq	$8, %r11
	movq	%rax, -8(%r11)
	cmpq	%r10, %r13
	jne	.L99
.L98:
	call	hin
	movq	24(%rsp), %r15
	addq	$1, %r14
	cmpq	%r14, %r15
	jg	.L102
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rsi
	cltq
	movslq	(%rsi,%rax,4), %r14
	cmpq	$1, %r15
	jle	.L103
	movq	%r14, %r12
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L105:
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rsi
	movq	%r14, %rdx
	cltq
	movslq	(%rsi,%rax,4), %r14
	cmpq	%rdx, %r14
	je	.L104
	movabsq	$-8543223828751151131, %rax
	movq	%r12, %rdi
	imulq	%r14, %rdi
	imulq	%rdi
	movq	%rdi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rdi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rdi
	movq	%rdi, %r12
.L104:
	addq	$1, %r13
	cmpq	%r13, %r15
	jne	.L105
	testq	%rbx, %rbx
	je	.L115
.L114:
	xorl	%r10d, %r10d
	leaq	8112(%rsp), %r11
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L108:
	movq	(%r11,%r10,8), %rdi
	testq	%rdi, %rdi
	jle	.L111
	movq	32(%rsp,%r10,8), %r8
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L109:
	movq	%r12, %rcx
	addq	$1, %rsi
	imulq	%r8, %rcx
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rcx
	movq	%rcx, %r12
	cmpq	%rdi, %rsi
	jne	.L109
.L111:
	addq	$1, %r10
	cmpq	%r10, %rbx
	jg	.L108
.L107:
	testq	%r15, %r15
	jle	.L118
	leaq	16192(%rsp), %rbp
.L115:
	movabsq	$-8543223828751151131, %r10
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L113:
	movslq	0(%rbp,%r11,8), %rbx
	movl	$31250000, %esi
	movq	%rbx, %rcx
	imulq	%rbx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %rdx
	imulq	%rcx, %rdx
	movq	%rdx, %rax
	movq	%rdx, %rcx
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %r13
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rcx, %rdx
	subq	%rax, %rdx
	movq	%rdx, %rcx
	imulq	%rdx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rcx, %rdx
	subq	%rax, %rdx
	movq	%rdx, %rdi
	imulq	%rdx, %rdi
	movq	%rdi, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movl	$1000000007, %edx
	subq	%rax, %rdi
	call	mbk
	movslq	%eax, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%r13, %rcx
	addq	$1, %r11
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%rbx, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%r12, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	addq	%r9, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %r9
	sarq	$29, %r9
	subq	%rax, %r9
	imulq	$1000000007, %r9, %rax
	subq	%rax, %rcx
	movq	%rcx, %r9
	cmpq	%r11, %r15
	jg	.L113
.L112:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	1816296(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L141
	addq	$1816312, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
	.p2align 4,,10
	.p2align 3
.L140:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L101
.L97:
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rdx
	cltq
	movslq	(%rdx,%rax,4), %r14
.L103:
	movq	%r14, %r12
	testq	%rbx, %rbx
	jne	.L114
	jmp	.L107
.L118:
	xorl	%r9d, %r9d
	jmp	.L112
.L141:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	N
	.bss
	.align 32
	.type	N, @object
	.size	N, 8000040
N:
	.zero	8000040
	.globl	H
	.align 32
	.type	H, @object
	.size	H, 8000040
H:
	.zero	8000040
	.globl	C
	.data
	.align 4
	.type	C, @object
	.size	C, 4
C:
	.long	1
	.globl	R
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.long	1
	.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	hyouka
	.type	hyouka, @function
hyouka:
.LFB23:
	.cfi_startproc
	endbr64
	movl	C(%rip), %edx
	movl	$1, %eax
	cmpl	%esi, %edx
	jl	.L1
	testl	%esi, %esi
	je	.L4
	cmpl	%edi, %edx
	jl	.L4
	leaq	H(%rip), %rdx
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	movslq	(%rdx,%rdi,4), %rcx
	movslq	(%rdx,%rsi,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rax,%rdx,4), %edx
	cmpl	%edx, (%rax,%rcx,4)
	setl	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE23:
	.size	hyouka, .-hyouka
	.p2align 4
	.globl	hin
	.type	hin, @function
hin:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	C(%rip), %rdx
	movslq	R(%rip), %rax
	movl	%edi, %r10d
	leaq	N(%rip), %r9
	leaq	H(%rip), %rcx
	leal	1(%rdx), %edi
	movl	%eax, H(%rip)
	movq	%rax, %r8
	movl	%edi, C(%rip)
	movl	%r10d, (%r9,%rax,4)
	movl	%edi, %r10d
	shrl	$31, %r10d
.L12:
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %edi
	jl	.L14
	testl	%eax, %eax
	je	.L16
	testb	%r10b, %r10b
	jne	.L16
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
.L18:
	movslq	%eax, %rsi
	movslq	(%rcx), %rbx
	movslq	(%rcx,%rsi,4), %r11
	movq	%r11, %rsi
	movl	(%r9,%r11,4), %r11d
	cmpl	%r11d, (%r9,%rbx,4)
	jge	.L9
.L10:
	movl	%esi, (%rcx,%rdx,4)
	movslq	%eax, %rdx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, %edi
	jl	.L8
	testl	%eax, %eax
	je	.L9
	testb	%r10b, %r10b
	je	.L18
.L9:
	leal	1(%r8), %eax
	movl	%r8d, (%rcx,%rdx,4)
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	%eax, R(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore 3
	leal	1(%r8), %eax
	movl	%r8d, (%rcx,%rdx,4)
	movl	%eax, R(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %esi
	movl	%esi, (%rcx,%rdx,4)
	movslq	%eax, %rdx
	jmp	.L12
	.cfi_endproc
.LFE24:
	.size	hin, .-hin
	.p2align 4
	.globl	hout
	.type	hout, @function
hout:
.LFB25:
	.cfi_startproc
	endbr64
	movl	C(%rip), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	H(%rip), %rcx
	movl	4+H(%rip), %r10d
	leal	-1(%rax), %edx
	movl	$1, %eax
	movslq	%edx, %rbx
	movl	%edx, C(%rip)
	movl	(%rcx,%rbx,4), %r11d
	testl	%edx, %edx
	jle	.L21
	movslq	%r11d, %r8
	movslq	%r10d, %rsi
	movl	$2, %eax
	movl	$1, %edi
	leaq	N(%rip), %r9
.L22:
	movl	(%r9,%r8,4), %r8d
	cmpl	%r8d, (%r9,%rsi,4)
	jge	.L30
	leal	(%rdi,%rdi), %eax
	leal	1(%rax), %r8d
	cmpl	%r8d, %edx
	jl	.L23
	cmpl	%eax, %edx
	jl	.L24
	cltq
	movslq	(%rcx,%rax,4), %rsi
	movslq	%r8d, %rax
	movslq	(%rcx,%rax,4), %rax
	movl	(%r9,%rax,4), %eax
	cmpl	%eax, (%r9,%rsi,4)
	movl	%r8d, %eax
	setl	%sil
	movzbl	%sil, %esi
	subl	%esi, %eax
.L23:
	movslq	%eax, %rsi
	movslq	(%rcx,%rsi,4), %rsi
	movl	%esi, (%rcx,%rdi,4)
	cmpl	%eax, %edx
	jl	.L30
	movslq	(%rcx,%rbx,4), %r8
	movslq	%eax, %rdi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L30:
	sarl	%eax
.L21:
	cltq
	movl	%r11d, (%rcx,%rax,4)
	movl	%r10d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movslq	%r8d, %rax
	movslq	(%rcx,%rax,4), %rsi
	movl	%r8d, %eax
	movl	%esi, (%rcx,%rdi,4)
	movslq	%eax, %rdi
	movslq	(%rcx,%rbx,4), %r8
	jmp	.L22
	.cfi_endproc
.LFE25:
	.size	hout, .-hout
	.p2align 4
	.globl	mbk
	.type	mbk, @function
mbk:
.LFB26:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jne	.L58
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L58:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %eax
	movl	%edx, %r8d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrl	$31, %eax
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addl	%esi, %eax
	movslq	%edx, %r13
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	sarl	%eax
	movl	%eax, %r12d
	jne	.L59
.L33:
	andl	$1, %ebx
	je	.L37
	imulq	%rbp, %rdx
.L37:
	movq	%rdx, %rax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	cqto
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	idivq	%r13
	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
	movl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	movq	%rdi, %rax
	imulq	%rdi, %rax
	cqto
	idivq	%r13
	testl	%esi, %esi
	leal	3(%rsi), %eax
	cmovns	%esi, %eax
	sarl	$2, %eax
	movl	%eax, %r14d
	movq	%rdx, %r15
	movl	$1, %edx
	jne	.L60
.L34:
	andl	$1, %r12d
	je	.L36
	imulq	%r15, %rdx
.L36:
	movq	%rdx, %rax
	cqto
	idivq	%r13
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%r15, %rax
	leal	7(%rsi), %esi
	imulq	%r15, %rax
	cqto
	idivq	%r13
	testl	%ebx, %ebx
	cmovns	%ebx, %esi
	sarl	$3, %esi
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%r13
	movq	%rdx, %rdi
	movl	%r8d, %edx
	call	mbk
	andl	$1, %r14d
	cltq
	je	.L35
	movq	8(%rsp), %rcx
	imulq	%rcx, %rax
.L35:
	cqto
	idivq	%r13
	jmp	.L34
	.cfi_endproc
.LFE26:
	.size	mbk, .-mbk
	.p2align 4
	.globl	inv
	.type	inv, @function
inv:
.LFB27:
	.cfi_startproc
	endbr64
	movl	%esi, %r10d
	subl	$2, %r10d
	jne	.L88
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%r10d, %eax
	movslq	%edi, %r9
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	shrl	$31, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	addl	%r10d, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	sarl	%eax
	movl	%eax, %r11d
	jne	.L89
.L63:
	andl	$1, %r10d
	je	.L67
	imulq	%r9, %rdx
.L67:
	movq	%rdx, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	cqto
	idivq	%rbx
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	movl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L89:
	.cfi_restore_state
	movq	%r9, %rax
	imulq	%r9, %rax
	cqto
	idivq	%rbx
	testl	%r10d, %r10d
	leal	1(%rsi), %eax
	cmovns	%r10d, %eax
	sarl	$2, %eax
	movl	%eax, %ebp
	movq	%rdx, %r12
	movl	$1, %edx
	jne	.L90
.L64:
	andl	$1, %r11d
	je	.L66
	imulq	%r12, %rdx
.L66:
	movq	%rdx, %rax
	cqto
	idivq	%rbx
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L90:
	movq	%r12, %rax
	imulq	%r12, %rax
	cqto
	idivq	%rbx
	testl	%r10d, %r10d
	leal	5(%rsi), %eax
	cmovns	%r10d, %eax
	sarl	$3, %eax
	movl	%eax, %r8d
	movq	%rdx, %rax
	movq	%rdx, %r13
	imulq	%rdx, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	%esi, %edx
	movl	%r8d, %esi
	call	mbk
	andl	$1, %ebp
	cltq
	je	.L65
	imulq	%r13, %rax
.L65:
	cqto
	idivq	%rbx
	jmp	.L64
	.cfi_endproc
.LFE27:
	.size	inv, .-inv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-1814528(%rsp), %r11
	.cfi_def_cfa 11, 1814584
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1784, %rsp
	.cfi_def_cfa_offset 1816368
	movl	$999994, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 1816296(%rsp)
	xorl	%eax, %eax
	leaq	816288(%rsp), %rdi
	movq	$257, 816272(%rsp)
	movq	$0, 816280(%rsp)
	call	memset@PLT
	leaq	24(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$2, %edx
	movl	$4, %eax
	leaq	816272(%rsp), %rcx
	jmp	.L93
	.p2align 4,,10
	.p2align 3
.L95:
	addq	$1, %rdx
	movq	%rdx, %rax
	imulq	%rdx, %rax
	cmpq	$1000009, %rax
	jg	.L139
.L93:
	cmpb	$0, (%rcx,%rdx)
	jne	.L95
	.p2align 4,,10
	.p2align 3
.L92:
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpq	$1000009, %rax
	jg	.L95
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpq	$1000009, %rax
	jle	.L92
	jmp	.L95
.L139:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L94:
	cmpb	$0, (%rcx,%rax)
	jne	.L96
	movq	%rax, 32(%rsp,%rbx,8)
	addq	$1, %rbx
.L96:
	addq	$1, %rax
	movq	%rax, %rdx
	imulq	%rax, %rdx
	cmpq	$1000009, %rdx
	jle	.L94
	movq	24(%rsp), %r15
	testq	%r15, %r15
	jle	.L97
	leaq	32(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	16192(%rsp), %rbp
	movq	%rax, (%rsp)
	leaq	(%rax,%rbx,8), %r13
	leaq	8112(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L102:
	movq	%r12, %rdi
	leaq	0(%rbp,%r14,8), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	0(%rbp,%r14,8), %rdi
	testq	%rbx, %rbx
	je	.L98
	movq	8(%rsp), %r11
	movq	(%rsp), %r10
	.p2align 4,,10
	.p2align 3
.L99:
	movq	%rdi, %rax
	movq	(%r10), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rsi
	testq	%rdx, %rdx
	jne	.L140
	.p2align 4,,10
	.p2align 3
.L100:
	movq	%rdi, %rax
	addq	$1, %rsi
	cqto
	idivq	%rcx
	cqto
	movq	%rax, %rdi
	idivq	%rcx
	testq	%rdx, %rdx
	je	.L100
.L101:
	movq	(%r11), %rax
	cmpq	%rsi, %rax
	cmovl	%rsi, %rax
	addq	$8, %r10
	addq	$8, %r11
	movq	%rax, -8(%r11)
	cmpq	%r10, %r13
	jne	.L99
.L98:
	call	hin
	movq	24(%rsp), %r15
	addq	$1, %r14
	cmpq	%r14, %r15
	jg	.L102
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rsi
	cltq
	movslq	(%rsi,%rax,4), %r14
	cmpq	$1, %r15
	jle	.L103
	movq	%r14, %r12
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L105:
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rsi
	movq	%r14, %rdx
	cltq
	movslq	(%rsi,%rax,4), %r14
	cmpq	%rdx, %r14
	je	.L104
	movabsq	$-8543223828751151131, %rax
	movq	%r12, %rdi
	imulq	%r14, %rdi
	imulq	%rdi
	movq	%rdi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rdi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rdi
	movq	%rdi, %r12
.L104:
	addq	$1, %r13
	cmpq	%r13, %r15
	jne	.L105
	testq	%rbx, %rbx
	je	.L115
.L114:
	xorl	%r10d, %r10d
	leaq	8112(%rsp), %r11
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L108:
	movq	(%r11,%r10,8), %rdi
	testq	%rdi, %rdi
	jle	.L111
	movq	32(%rsp,%r10,8), %r8
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L109:
	movq	%r12, %rcx
	addq	$1, %rsi
	imulq	%r8, %rcx
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rcx
	movq	%rcx, %r12
	cmpq	%rdi, %rsi
	jne	.L109
.L111:
	addq	$1, %r10
	cmpq	%r10, %rbx
	jg	.L108
.L107:
	testq	%r15, %r15
	jle	.L118
	leaq	16192(%rsp), %rbp
.L115:
	movabsq	$-8543223828751151131, %r10
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L113:
	movslq	0(%rbp,%r11,8), %rbx
	movl	$31250000, %esi
	movq	%rbx, %rcx
	imulq	%rbx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %rdx
	imulq	%rcx, %rdx
	movq	%rdx, %rax
	movq	%rdx, %rcx
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %r13
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rcx, %rdx
	subq	%rax, %rdx
	movq	%rdx, %rcx
	imulq	%rdx, %rcx
	movq	%rcx, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rcx, %rdx
	subq	%rax, %rdx
	movq	%rdx, %rdi
	imulq	%rdx, %rdi
	movq	%rdi, %rax
	mulq	%r10
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movl	$1000000007, %edx
	subq	%rax, %rdi
	call	mbk
	movslq	%eax, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%r13, %rcx
	addq	$1, %r11
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%rbx, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	imulq	%r12, %rcx
	movq	%rcx, %rax
	imulq	%r10
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	sarq	$29, %rax
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	addq	%r9, %rcx
	movq	%rcx, %rax
	imulq	%r10
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %r9
	sarq	$29, %r9
	subq	%rax, %r9
	imulq	$1000000007, %r9, %rax
	subq	%rax, %rcx
	movq	%rcx, %r9
	cmpq	%r11, %r15
	jg	.L113
.L112:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	1816296(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L141
	addq	$1816312, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
	.p2align 4,,10
	.p2align 3
.L140:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L101
.L97:
	xorl	%eax, %eax
	call	hout
	leaq	N(%rip), %rdx
	cltq
	movslq	(%rdx,%rax,4), %r14
.L103:
	movq	%r14, %r12
	testq	%rbx, %rbx
	jne	.L114
	jmp	.L107
.L118:
	xorl	%r9d, %r9d
	jmp	.L112
.L141:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	N
	.bss
	.align 32
	.type	N, @object
	.size	N, 8000040
N:
	.zero	8000040
	.globl	H
	.align 32
	.type	H, @object
	.size	H, 8000040
H:
	.zero	8000040
	.globl	C
	.data
	.align 4
	.type	C, @object
	.size	C, 4
C:
	.long	1
	.globl	R
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.long	1
	.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>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int main(){
  long long n,i,j,k,NN=1e6+10,M=1e9+7,pr[1010],r=0,a[100010],b[1010],x,ans=0;
  char p[1000010]={1,1};
  scanf("%lld",&n);
  for(i=2;i*i<NN;i++){
    if(p[i])continue;
    for(j=i*i;j<NN;j+=i)p[j]=1;
  }
  for(i=0;i*i<NN;i++){
    if(p[i])continue;
    pr[r++]=i;
  }
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    x=a[i];
    for(j=0;j<r;j++){
      for(k=0;x%pr[j]==0;k++)x/=pr[j];
      if(b[j]<k)b[j]=k;
    }
    hin(x);
  }
  x=k=N[hout()];
  for(i=1;i<n;i++){
    j=N[hout()];
    if(x==j)continue;
    k=(k*j)%M;
    x=j;
  }
  for(i=0;i<r;i++){
    for(j=0;j<b[i];j++)k=(k*pr[i])%M;
  }
  //printf("%lld\n",k);
  //for(i=0;i<n;i++)printf("%lld\n",k*inv(a[i],M));
  for(i=0;i<n;i++)ans=(ans+(k*inv(a[i],M)%M))%M;
  printf("%lld\n",ans);
  return 0;
}

3
2 3 2
 3
1000000 999999 1014329
 5
11 12 12 12 12
 3
2 6 2
 3
1000000 999999 1246389
 5
11 17 12 12 12
 3
1 6 2
 3
1000000 1225154 1246389
 5
11 17 14 12 12
 3
1001000 1225154 1246389

8
 655964475
 56
 7
 258576389
 897
 10
 280720460
 6092
 788070284

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>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int main(){
  long long n,i,j,k,NN=1e6+10,M=1e9+7,pr[1010],r=0,a[100010],b[1010],x,ans=0;
  char p[1000010]={1,1};
  scanf("%lld",&n);
  for(i=2;i*i<NN;i++){
    if(p[i])continue;
    for(j=i*i;j<NN;j+=i)p[j]=1;
  }
  for(i=0;i*i<NN;i++){
    if(p[i])continue;
    pr[r++]=i;
  }
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    x=a[i];
    for(j=0;j<r;j++){
      for(k=0;x%pr[j]==0;k++)x/=pr[j];
      if(b[j]<k)b[j]=k;
    }
    hin(x);
  }
  x=k=N[hout()];
  for(i=1;i<n;i++){
    j=N[hout()];
    if(x==j)continue;
    k=(k*j)%M;
    x=j;
  }
  for(i=0;i<r;i++){
    for(j=0;j<b[i];j++)k=(k*pr[i])%M;
  }
  //printf("%lld\n",k);
  //for(i=0;i<n;i++)printf("%lld\n",k*inv(a[i],M));
  for(i=0;i<n;i++)ans=(ans+(k*inv(a[i],M)%M))%M;
  printf("%lld\n",ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	R
	.data
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.long	1
	.globl	C
	.align 4
	.type	C, @object
	.size	C, 4
C:
	.long	1
	.globl	H
	.bss
	.align 32
	.type	H, @object
	.size	H, 8000040
H:
	.zero	8000040
	.globl	N
	.align 32
	.type	N, @object
	.size	N, 8000040
N:
	.zero	8000040
	.text
	.globl	hyouka
	.type	hyouka, @function
hyouka:
.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	C(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	C(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jg	.L4
	cmpl	$0, -8(%rbp)
	jne	.L5
.L4:
	movl	$0, %eax
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	hyouka, .-hyouka
	.globl	hin
	.type	hin, @function
hin:
.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	C(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, C(%rip)
	movl	%eax, -4(%rbp)
	movl	R(%rip), %eax
	movl	%eax, H(%rip)
	movl	H(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
.L7:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movl	$0, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L8
	movl	R(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, R(%rip)
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hin, .-hin
	.globl	hout
	.type	hout, @function
hout:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	4+H(%rip), %eax
	movl	%eax, -16(%rbp)
	movl	$2, -20(%rbp)
	movl	C(%rip), %eax
	subl	$1, %eax
	movl	%eax, C(%rip)
	movl	C(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -24(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %ebx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L10:
	movl	C(%rip), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hout, .-hout
	.globl	mbk
	.type	mbk, @function
mbk:
.LFB3:
	.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)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	cmpl	$0, -12(%rbp)
	je	.L14
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	movq	%rcx, %rdi
	call	mbk
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	movq	-8(%rbp), %rax
	jmp	.L16
.L15:
	movl	$1, %eax
.L16:
	imulq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	jmp	.L18
.L14:
	movl	$1, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	mbk, .-mbk
	.globl	inv
	.type	inv, @function
inv:
.LFB4:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mbk
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	inv, .-inv
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1814528(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1824, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1000010, -1816288(%rbp)
	movq	$1000000007, -1816280(%rbp)
	movq	$0, -1816312(%rbp)
	movq	$0, -1816296(%rbp)
	movq	$257, -1000032(%rbp)
	movq	$0, -1000024(%rbp)
	leaq	-1000016(%rbp), %rax
	movl	$999994, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1816344(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1816336(%rbp)
	jmp	.L22
.L27:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L51
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -1816328(%rbp)
	jmp	.L25
.L26:
	leaq	-1000032(%rbp), %rdx
	movq	-1816328(%rbp), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movq	-1816336(%rbp), %rax
	addq	%rax, -1816328(%rbp)
.L25:
	movq	-1816328(%rbp), %rax
	cmpq	-1816288(%rbp), %rax
	jl	.L26
	jmp	.L24
.L51:
	nop
.L24:
	addq	$1, -1816336(%rbp)
.L22:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L27
	movq	$0, -1816336(%rbp)
	jmp	.L28
.L31:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L52
	movq	-1816312(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1816312(%rbp)
	movq	-1816336(%rbp), %rdx
	movq	%rdx, -1816272(%rbp,%rax,8)
	jmp	.L30
.L52:
	nop
.L30:
	addq	$1, -1816336(%rbp)
.L28:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L31
	movq	$0, -1816336(%rbp)
	jmp	.L32
.L38:
	leaq	-1800112(%rbp), %rdx
	movq	-1816336(%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
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movq	%rax, -1816304(%rbp)
	movq	$0, -1816328(%rbp)
	jmp	.L33
.L37:
	movq	$0, -1816320(%rbp)
	jmp	.L34
.L35:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, -1816304(%rbp)
	addq	$1, -1816320(%rbp)
.L34:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L35
	movq	-1816328(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816320(%rbp)
	jle	.L36
	movq	-1816328(%rbp), %rax
	movq	-1816320(%rbp), %rdx
	movq	%rdx, -1808192(%rbp,%rax,8)
.L36:
	addq	$1, -1816328(%rbp)
.L33:
	movq	-1816328(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L37
	movq	-1816304(%rbp), %rax
	movl	%eax, %edi
	call	hin
	addq	$1, -1816336(%rbp)
.L32:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L38
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816320(%rbp)
	movq	-1816320(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	movq	$1, -1816336(%rbp)
	jmp	.L39
.L42:
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816328(%rbp)
	movq	-1816304(%rbp), %rax
	cmpq	-1816328(%rbp), %rax
	je	.L53
	movq	-1816320(%rbp), %rax
	imulq	-1816328(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	movq	-1816328(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	jmp	.L41
.L53:
	nop
.L41:
	addq	$1, -1816336(%rbp)
.L39:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L42
	movq	$0, -1816336(%rbp)
	jmp	.L43
.L46:
	movq	$0, -1816328(%rbp)
	jmp	.L44
.L45:
	movq	-1816336(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rax
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	addq	$1, -1816328(%rbp)
.L44:
	movq	-1816336(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816328(%rbp)
	jl	.L45
	addq	$1, -1816336(%rbp)
.L43:
	movq	-1816336(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L46
	movq	$0, -1816336(%rbp)
	jmp	.L47
.L48:
	movq	-1816280(%rbp), %rax
	movl	%eax, %edx
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	inv
	cltq
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	-1816296(%rbp), %rax
	addq	%rdx, %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816296(%rbp)
	addq	$1, -1816336(%rbp)
.L47:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L48
	movq	-1816296(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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	R
	.data
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.long	1
	.globl	C
	.align 4
	.type	C, @object
	.size	C, 4
C:
	.long	1
	.globl	H
	.bss
	.align 32
	.type	H, @object
	.size	H, 8000040
H:
	.zero	8000040
	.globl	N
	.align 32
	.type	N, @object
	.size	N, 8000040
N:
	.zero	8000040
	.text
	.globl	hyouka
	.type	hyouka, @function
hyouka:
.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	C(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	C(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jg	.L4
	cmpl	$0, -8(%rbp)
	jne	.L5
.L4:
	movl	$0, %eax
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	hyouka, .-hyouka
	.globl	hin
	.type	hin, @function
hin:
.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	C(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, C(%rip)
	movl	%eax, -4(%rbp)
	movl	R(%rip), %eax
	movl	%eax, H(%rip)
	movl	H(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	N(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
.L7:
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movl	$0, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L8
	movl	R(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, R(%rip)
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hin, .-hin
	.globl	hout
	.type	hout, @function
hout:
.LFB2:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movl	4+H(%rip), %eax
	movl	%eax, -16(%rbp)
	movl	$2, -20(%rbp)
	movl	C(%rip), %eax
	subl	$1, %eax
	movl	%eax, C(%rip)
	movl	C(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -24(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %ebx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	H(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	H(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L10:
	movl	C(%rip), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hyouka
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	H(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hout, .-hout
	.globl	mbk
	.type	mbk, @function
mbk:
.LFB3:
	.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)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	cmpl	$0, -12(%rbp)
	je	.L14
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	movq	%rcx, %rdi
	call	mbk
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	movq	-8(%rbp), %rax
	jmp	.L16
.L15:
	movl	$1, %eax
.L16:
	imulq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	jmp	.L18
.L14:
	movl	$1, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	mbk, .-mbk
	.globl	inv
	.type	inv, @function
inv:
.LFB4:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mbk
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	inv, .-inv
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1814528(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1824, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1000010, -1816288(%rbp)
	movq	$1000000007, -1816280(%rbp)
	movq	$0, -1816312(%rbp)
	movq	$0, -1816296(%rbp)
	movq	$257, -1000032(%rbp)
	movq	$0, -1000024(%rbp)
	leaq	-1000016(%rbp), %rax
	movl	$999994, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1816344(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1816336(%rbp)
	jmp	.L22
.L27:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L51
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -1816328(%rbp)
	jmp	.L25
.L26:
	leaq	-1000032(%rbp), %rdx
	movq	-1816328(%rbp), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movq	-1816336(%rbp), %rax
	addq	%rax, -1816328(%rbp)
.L25:
	movq	-1816328(%rbp), %rax
	cmpq	-1816288(%rbp), %rax
	jl	.L26
	jmp	.L24
.L51:
	nop
.L24:
	addq	$1, -1816336(%rbp)
.L22:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L27
	movq	$0, -1816336(%rbp)
	jmp	.L28
.L31:
	leaq	-1000032(%rbp), %rdx
	movq	-1816336(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L52
	movq	-1816312(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1816312(%rbp)
	movq	-1816336(%rbp), %rdx
	movq	%rdx, -1816272(%rbp,%rax,8)
	jmp	.L30
.L52:
	nop
.L30:
	addq	$1, -1816336(%rbp)
.L28:
	movq	-1816336(%rbp), %rax
	imulq	%rax, %rax
	cmpq	%rax, -1816288(%rbp)
	jg	.L31
	movq	$0, -1816336(%rbp)
	jmp	.L32
.L38:
	leaq	-1800112(%rbp), %rdx
	movq	-1816336(%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
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movq	%rax, -1816304(%rbp)
	movq	$0, -1816328(%rbp)
	jmp	.L33
.L37:
	movq	$0, -1816320(%rbp)
	jmp	.L34
.L35:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, -1816304(%rbp)
	addq	$1, -1816320(%rbp)
.L34:
	movq	-1816328(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rcx
	movq	-1816304(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L35
	movq	-1816328(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816320(%rbp)
	jle	.L36
	movq	-1816328(%rbp), %rax
	movq	-1816320(%rbp), %rdx
	movq	%rdx, -1808192(%rbp,%rax,8)
.L36:
	addq	$1, -1816328(%rbp)
.L33:
	movq	-1816328(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L37
	movq	-1816304(%rbp), %rax
	movl	%eax, %edi
	call	hin
	addq	$1, -1816336(%rbp)
.L32:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L38
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816320(%rbp)
	movq	-1816320(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	movq	$1, -1816336(%rbp)
	jmp	.L39
.L42:
	movl	$0, %eax
	call	hout
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	N(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movq	%rax, -1816328(%rbp)
	movq	-1816304(%rbp), %rax
	cmpq	-1816328(%rbp), %rax
	je	.L53
	movq	-1816320(%rbp), %rax
	imulq	-1816328(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	movq	-1816328(%rbp), %rax
	movq	%rax, -1816304(%rbp)
	jmp	.L41
.L53:
	nop
.L41:
	addq	$1, -1816336(%rbp)
.L39:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L42
	movq	$0, -1816336(%rbp)
	jmp	.L43
.L46:
	movq	$0, -1816328(%rbp)
	jmp	.L44
.L45:
	movq	-1816336(%rbp), %rax
	movq	-1816272(%rbp,%rax,8), %rax
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816320(%rbp)
	addq	$1, -1816328(%rbp)
.L44:
	movq	-1816336(%rbp), %rax
	movq	-1808192(%rbp,%rax,8), %rax
	cmpq	%rax, -1816328(%rbp)
	jl	.L45
	addq	$1, -1816336(%rbp)
.L43:
	movq	-1816336(%rbp), %rax
	cmpq	-1816312(%rbp), %rax
	jl	.L46
	movq	$0, -1816336(%rbp)
	jmp	.L47
.L48:
	movq	-1816280(%rbp), %rax
	movl	%eax, %edx
	movq	-1816336(%rbp), %rax
	movq	-1800112(%rbp,%rax,8), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	inv
	cltq
	imulq	-1816320(%rbp), %rax
	cqto
	idivq	-1816280(%rbp)
	movq	-1816296(%rbp), %rax
	addq	%rdx, %rax
	cqto
	idivq	-1816280(%rbp)
	movq	%rdx, -1816296(%rbp)
	addq	$1, -1816336(%rbp)
.L47:
	movq	-1816344(%rbp), %rax
	cmpq	%rax, -1816336(%rbp)
	jl	.L48
	movq	-1816296(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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:
