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

```c
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(int i = 0; i < (n); ++i)
 
#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
int StrLen(char *s) { for(int ptr = 0;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
int StrDel(char *s, int n) { int l = StrLen(s); s[l - n + 1] = '\0'; return l - n; }

int NumDigits(int i){ char s[20]; return sprintf(s, "%d", i); }
int NumDigitsLL(long long l){ char s[30]; sprintf(s, "%lld", l); return strlen(s); }

int is1stAns = 1;
#ifdef __cplusplus
template <class T> 
void print(T t) { if (is1stAns) cout << t, is1stAns = 0; else cout << " " << t; }
#else
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }
#endif

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    int N; scanf("%d", &N);
    ll *A = (ll *)malloc(sizeof(ll) * (N + 9));
    ll *B = (ll *)malloc(sizeof(ll) * (N + 9));

    rep(i, N + 1) scanf("%lld", &A[i]);
    rep(i, N) scanf("%lld", &B[i]);

    ll ans = 0;
/*    rep(i, N){
        if (A[i] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i];
            B[i] -= A[i];
            if (A[i + 1] >= B[i]){
                ans += B[i];
                A[i + 1] -= B[i];
            } else {
                ans += A[i + 1];
                A[i + 1] = 0;
            }
        }
    }
*/

    // 前からだとWAになったので、後ろから倒してみる

    for (int i = N - 1; i >= 0; --i){
        if (A[i + 1] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i + 1]; B[i] -= A[i + 1];
            if (A[i] >= B[i]){
                ans += B[i]; A[i] -= B[i];
            } else {
                ans += A[i]; A[i] = 0;
            }
        }
    }


    printf("%lld\n", ans);

    free(A);
    free(B);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	StrLen
	.type	StrLen, @function
StrLen:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L5
.L2:
	addl	$1, -4(%rbp)
	jmp	.L4
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	StrLen, .-StrLen
	.globl	StrDel
	.type	StrDel, @function
StrDel:
.LFB7:
	.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)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	StrLen
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	cltq
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	StrDel, .-StrDel
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	NumDigits
	.type	NumDigits, @function
NumDigits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %edx
	leaq	-32(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	NumDigits, .-NumDigits
	.section	.rodata
.LC1:
	.string	"%lld"
	.text
	.globl	NumDigitsLL
	.type	NumDigitsLL, @function
NumDigitsLL:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	NumDigitsLL, .-NumDigitsLL
	.globl	is1stAns
	.data
	.align 4
	.type	is1stAns, @object
	.size	is1stAns, 4
is1stAns:
	.long	1
	.section	.rodata
.LC2:
	.string	" %d"
	.text
	.globl	printI
	.type	printI, @function
printI:
.LFB10:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L17
.L15:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L17:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	printI, .-printI
	.section	.rodata
.LC3:
	.string	" %lld"
	.text
	.globl	printL
	.type	printL, @function
printL:
.LFB11:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L19
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L21
.L19:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	printL, .-printL
	.section	.rodata
.LC4:
	.string	"%.9f"
.LC5:
	.string	" %.9f"
	.text
	.globl	printD
	.type	printD, @function
printD:
.LFB12:
	.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
	movsd	%xmm0, -8(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L25
.L23:
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L25:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	printD, .-printD
	.section	.rodata
.LC6:
	.string	" %c"
	.text
	.globl	printC
	.type	printC, @function
printC:
.LFB13:
	.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, %eax
	movb	%al, -4(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movsbl	-4(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L29
.L27:
	movsbl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L29:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	printC, .-printC
	.section	.rodata
.LC7:
	.string	"%s"
.LC8:
	.string	" %s"
	.text
	.globl	printS
	.type	printS, @function
printS:
.LFB14:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L31
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L33
.L31:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L33:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	printS, .-printS
	.section	.rodata
.LC9:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L35
.L36:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L35:
	movl	-48(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L36
	movl	$0, -40(%rbp)
	jmp	.L37
.L38:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L37:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L38
	movq	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
	jmp	.L39
.L43:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L40
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	jmp	.L41
.L40:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L42
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	jmp	.L41
.L42:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L41:
	subl	$1, -36(%rbp)
.L39:
	cmpl	$0, -36(%rbp)
	jns	.L43
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC9(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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	StrLen
	.type	StrLen, @function
StrLen:
.LFB51:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	cmpb	$0, (%rdi)
	movl	$1, %eax
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpb	$0, -1(%rdi,%rax)
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	StrLen, .-StrLen
	.p2align 4
	.globl	StrDel
	.type	StrDel, @function
StrDel:
.LFB52:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	cmpb	$0, (%rdi)
	movl	$1, %edx
	je	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%edx, %eax
	addq	$1, %rdx
	cmpb	$0, -1(%rdi,%rdx)
	jne	.L8
.L9:
	subl	%esi, %eax
	movslq	%eax, %rdx
	movb	$0, 1(%rdi,%rdx)
	ret
	.cfi_endproc
.LFE52:
	.size	StrDel, .-StrDel
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	NumDigits
	.type	NumDigits, @function
NumDigits:
.LFB53:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, %r8d
	movl	$20, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	leaq	.LC0(%rip), %rcx
	call	__sprintf_chk@PLT
	movq	24(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	NumDigits, .-NumDigits
	.section	.rodata.str1.1
.LC1:
	.string	"%lld"
	.text
	.p2align 4
	.globl	NumDigitsLL
	.type	NumDigitsLL, @function
NumDigitsLL:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %r8
	movl	$30, %edx
	leaq	.LC1(%rip), %rcx
	movl	$1, %esi
	subq	$48, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	__sprintf_chk@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L20
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	NumDigitsLL, .-NumDigitsLL
	.section	.rodata.str1.1
.LC2:
	.string	" %d"
	.text
	.p2align 4
	.globl	printI
	.type	printI, @function
printI:
.LFB55:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movl	%edi, %edx
	testl	%eax, %eax
	je	.L22
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE55:
	.size	printI, .-printI
	.section	.rodata.str1.1
.LC3:
	.string	" %lld"
	.text
	.p2align 4
	.globl	printL
	.type	printL, @function
printL:
.LFB56:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movq	%rdi, %rdx
	testl	%eax, %eax
	je	.L29
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L29:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE56:
	.size	printL, .-printL
	.section	.rodata.str1.1
.LC4:
	.string	"%.9f"
.LC5:
	.string	" %.9f"
	.text
	.p2align 4
	.globl	printD
	.type	printD, @function
printD:
.LFB57:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L36
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE57:
	.size	printD, .-printD
	.section	.rodata.str1.1
.LC6:
	.string	" %c"
	.text
	.p2align 4
	.globl	printC
	.type	printC, @function
printC:
.LFB58:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movsbl	%dil, %edx
	testl	%eax, %eax
	je	.L43
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	%edx, %edi
	call	putchar@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE58:
	.size	printC, .-printC
	.section	.rodata.str1.1
.LC7:
	.string	"%s"
.LC8:
	.string	" %s"
	.text
	.p2align 4
	.globl	printS
	.type	printS, @function
printS:
.LFB59:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movq	%rdi, %rdx
	testl	%eax, %eax
	je	.L50
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC7(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE59:
	.size	printS, .-printS
	.section	.rodata.str1.1
.LC9:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	leal	9(%rbx), %r12d
	movslq	%r12d, %r12
	salq	$3, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r12
	testl	%ebx, %ebx
	js	.L60
	movq	%rbp, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$8, %r14
	cmpl	%r13d, %ebx
	jge	.L58
	testl	%ebx, %ebx
	jle	.L60
	movq	%r12, %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L59:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$8, %r14
	cmpl	%r13d, %ebx
	jg	.L59
.L60:
	subl	$1, %ebx
	js	.L67
	movslq	%ebx, %rax
	xorl	%r8d, %r8d
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L72:
	addq	%rdx, %r8
.L63:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L61
.L65:
	movq	8(%rbp,%rax,8), %rcx
	movq	(%r12,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jge	.L72
	movq	%rdx, %rdi
	movq	0(%rbp,%rax,8), %rsi
	subq	%rcx, %rdi
	movq	%rdi, (%r12,%rax,8)
	cmpq	%rsi, %rdi
	jg	.L64
	subq	%rdi, %rsi
	addq	%rdx, %r8
	movq	%rsi, 0(%rbp,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jns	.L65
.L61:
	movq	%r8, %rdx
	leaq	.LC9(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L73
	addq	$24, %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
.L64:
	.cfi_restore_state
	movq	$0, 0(%rbp,%rax,8)
	addq	%rcx, %r8
	addq	%rsi, %r8
	jmp	.L63
.L67:
	xorl	%r8d, %r8d
	jmp	.L61
.L73:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.globl	is1stAns
	.data
	.align 4
	.type	is1stAns, @object
	.size	is1stAns, 4
is1stAns:
	.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	StrLen
	.type	StrLen, @function
StrLen:
.LFB51:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	cmpb	$0, (%rdi)
	movl	$1, %eax
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpb	$0, -1(%rdi,%rax)
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	StrLen, .-StrLen
	.p2align 4
	.globl	StrDel
	.type	StrDel, @function
StrDel:
.LFB52:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	cmpb	$0, (%rdi)
	movl	$1, %edx
	je	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%edx, %eax
	addq	$1, %rdx
	cmpb	$0, -1(%rdi,%rdx)
	jne	.L8
.L9:
	subl	%esi, %eax
	movslq	%eax, %rdx
	movb	$0, 1(%rdi,%rdx)
	ret
	.cfi_endproc
.LFE52:
	.size	StrDel, .-StrDel
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	NumDigits
	.type	NumDigits, @function
NumDigits:
.LFB53:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, %r8d
	movl	$20, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	leaq	.LC0(%rip), %rcx
	call	__sprintf_chk@PLT
	movq	24(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	NumDigits, .-NumDigits
	.section	.rodata.str1.1
.LC1:
	.string	"%lld"
	.text
	.p2align 4
	.globl	NumDigitsLL
	.type	NumDigitsLL, @function
NumDigitsLL:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %r8
	movl	$30, %edx
	leaq	.LC1(%rip), %rcx
	movl	$1, %esi
	subq	$48, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	__sprintf_chk@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L20
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	NumDigitsLL, .-NumDigitsLL
	.section	.rodata.str1.1
.LC2:
	.string	" %d"
	.text
	.p2align 4
	.globl	printI
	.type	printI, @function
printI:
.LFB55:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movl	%edi, %edx
	testl	%eax, %eax
	je	.L22
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE55:
	.size	printI, .-printI
	.section	.rodata.str1.1
.LC3:
	.string	" %lld"
	.text
	.p2align 4
	.globl	printL
	.type	printL, @function
printL:
.LFB56:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movq	%rdi, %rdx
	testl	%eax, %eax
	je	.L29
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L29:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE56:
	.size	printL, .-printL
	.section	.rodata.str1.1
.LC4:
	.string	"%.9f"
.LC5:
	.string	" %.9f"
	.text
	.p2align 4
	.globl	printD
	.type	printD, @function
printD:
.LFB57:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L36
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE57:
	.size	printD, .-printD
	.section	.rodata.str1.1
.LC6:
	.string	" %c"
	.text
	.p2align 4
	.globl	printC
	.type	printC, @function
printC:
.LFB58:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movsbl	%dil, %edx
	testl	%eax, %eax
	je	.L43
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	%edx, %edi
	call	putchar@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE58:
	.size	printC, .-printC
	.section	.rodata.str1.1
.LC7:
	.string	"%s"
.LC8:
	.string	" %s"
	.text
	.p2align 4
	.globl	printS
	.type	printS, @function
printS:
.LFB59:
	.cfi_startproc
	endbr64
	movl	is1stAns(%rip), %eax
	movq	%rdi, %rdx
	testl	%eax, %eax
	je	.L50
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC7(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, is1stAns(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE59:
	.size	printS, .-printS
	.section	.rodata.str1.1
.LC9:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	leal	9(%rbx), %r12d
	movslq	%r12d, %r12
	salq	$3, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r12
	testl	%ebx, %ebx
	js	.L60
	movq	%rbp, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$8, %r14
	cmpl	%r13d, %ebx
	jge	.L58
	testl	%ebx, %ebx
	jle	.L60
	movq	%r12, %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L59:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$8, %r14
	cmpl	%r13d, %ebx
	jg	.L59
.L60:
	subl	$1, %ebx
	js	.L67
	movslq	%ebx, %rax
	xorl	%r8d, %r8d
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L72:
	addq	%rdx, %r8
.L63:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L61
.L65:
	movq	8(%rbp,%rax,8), %rcx
	movq	(%r12,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jge	.L72
	movq	%rdx, %rdi
	movq	0(%rbp,%rax,8), %rsi
	subq	%rcx, %rdi
	movq	%rdi, (%r12,%rax,8)
	cmpq	%rsi, %rdi
	jg	.L64
	subq	%rdi, %rsi
	addq	%rdx, %r8
	movq	%rsi, 0(%rbp,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jns	.L65
.L61:
	movq	%r8, %rdx
	leaq	.LC9(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L73
	addq	$24, %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
.L64:
	.cfi_restore_state
	movq	$0, 0(%rbp,%rax,8)
	addq	%rcx, %r8
	addq	%rsi, %r8
	jmp	.L63
.L67:
	xorl	%r8d, %r8d
	jmp	.L61
.L73:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.globl	is1stAns
	.data
	.align 4
	.type	is1stAns, @object
	.size	is1stAns, 4
is1stAns:
	.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:

#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(int i = 0; i < (n); ++i)
 
#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
int StrLen(char *s) { for(int ptr = 0;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
int StrDel(char *s, int n) { int l = StrLen(s); s[l - n + 1] = '\0'; return l - n; }

int NumDigits(int i){ char s[20]; return sprintf(s, "%d", i); }
int NumDigitsLL(long long l){ char s[30]; sprintf(s, "%lld", l); return strlen(s); }

int is1stAns = 1;
#ifdef __cplusplus
template <class T> 
void print(T t) { if (is1stAns) cout << t, is1stAns = 0; else cout << " " << t; }
#else
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }
#endif

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    int N; scanf("%d", &N);
    ll *A = (ll *)malloc(sizeof(ll) * (N + 9));
    ll *B = (ll *)malloc(sizeof(ll) * (N + 9));

    rep(i, N + 1) scanf("%lld", &A[i]);
    rep(i, N) scanf("%lld", &B[i]);

    ll ans = 0;
/*    rep(i, N){
        if (A[i] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i];
            B[i] -= A[i];
            if (A[i + 1] >= B[i]){
                ans += B[i];
                A[i + 1] -= B[i];
            } else {
                ans += A[i + 1];
                A[i + 1] = 0;
            }
        }
    }
*/

    // 前からだとWAになったので、後ろから倒してみる

    for (int i = N - 1; i >= 0; --i){
        if (A[i + 1] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i + 1]; B[i] -= A[i + 1];
            if (A[i] >= B[i]){
                ans += B[i]; A[i] -= B[i];
            } else {
                ans += A[i]; A[i] = 0;
            }
        }
    }


    printf("%lld\n", ans);

    free(A);
    free(B);
    return 0;
}

3
5 6 3 8
2 100 8
 2
100 0 1
1 100
 2
3 5 2
7 5
 3
0 6 3 8
2 100 8
 2
100 -1 1
1 100
 2
3 5 1
7 5
 3
0 4 3 8
2 100 8
 2
000 -1 1
1 100
 2
3 5 1
0 5
 3
0 4 2 8
2 100 8

19
 2
 10
 17
 1
 9
 15
 0
 5
 14

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

```c
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(int i = 0; i < (n); ++i)
 
#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
int StrLen(char *s) { for(int ptr = 0;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
int StrDel(char *s, int n) { int l = StrLen(s); s[l - n + 1] = '\0'; return l - n; }

int NumDigits(int i){ char s[20]; return sprintf(s, "%d", i); }
int NumDigitsLL(long long l){ char s[30]; sprintf(s, "%lld", l); return strlen(s); }

int is1stAns = 1;
#ifdef __cplusplus
template <class T> 
void print(T t) { if (is1stAns) cout << t, is1stAns = 0; else cout << " " << t; }
#else
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }
#endif

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    int N; scanf("%d", &N);
    ll *A = (ll *)malloc(sizeof(ll) * (N + 9));
    ll *B = (ll *)malloc(sizeof(ll) * (N + 9));

    rep(i, N + 1) scanf("%lld", &A[i]);
    rep(i, N) scanf("%lld", &B[i]);

    ll ans = 0;
/*    rep(i, N){
        if (A[i] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i];
            B[i] -= A[i];
            if (A[i + 1] >= B[i]){
                ans += B[i];
                A[i + 1] -= B[i];
            } else {
                ans += A[i + 1];
                A[i + 1] = 0;
            }
        }
    }
*/

    // 前からだとWAになったので、後ろから倒してみる

    for (int i = N - 1; i >= 0; --i){
        if (A[i + 1] >= B[i]){
            ans += B[i];
        } else {
            ans += A[i + 1]; B[i] -= A[i + 1];
            if (A[i] >= B[i]){
                ans += B[i]; A[i] -= B[i];
            } else {
                ans += A[i]; A[i] = 0;
            }
        }
    }


    printf("%lld\n", ans);

    free(A);
    free(B);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	StrLen
	.type	StrLen, @function
StrLen:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L5
.L2:
	addl	$1, -4(%rbp)
	jmp	.L4
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	StrLen, .-StrLen
	.globl	StrDel
	.type	StrDel, @function
StrDel:
.LFB7:
	.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)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	StrLen
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	cltq
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	StrDel, .-StrDel
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	NumDigits
	.type	NumDigits, @function
NumDigits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %edx
	leaq	-32(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	NumDigits, .-NumDigits
	.section	.rodata
.LC1:
	.string	"%lld"
	.text
	.globl	NumDigitsLL
	.type	NumDigitsLL, @function
NumDigitsLL:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	NumDigitsLL, .-NumDigitsLL
	.globl	is1stAns
	.data
	.align 4
	.type	is1stAns, @object
	.size	is1stAns, 4
is1stAns:
	.long	1
	.section	.rodata
.LC2:
	.string	" %d"
	.text
	.globl	printI
	.type	printI, @function
printI:
.LFB10:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L17
.L15:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L17:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	printI, .-printI
	.section	.rodata
.LC3:
	.string	" %lld"
	.text
	.globl	printL
	.type	printL, @function
printL:
.LFB11:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L19
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L21
.L19:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	printL, .-printL
	.section	.rodata
.LC4:
	.string	"%.9f"
.LC5:
	.string	" %.9f"
	.text
	.globl	printD
	.type	printD, @function
printD:
.LFB12:
	.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
	movsd	%xmm0, -8(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L25
.L23:
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L25:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	printD, .-printD
	.section	.rodata
.LC6:
	.string	" %c"
	.text
	.globl	printC
	.type	printC, @function
printC:
.LFB13:
	.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, %eax
	movb	%al, -4(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movsbl	-4(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L29
.L27:
	movsbl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L29:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	printC, .-printC
	.section	.rodata
.LC7:
	.string	"%s"
.LC8:
	.string	" %s"
	.text
	.globl	printS
	.type	printS, @function
printS:
.LFB14:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L31
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L33
.L31:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L33:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	printS, .-printS
	.section	.rodata
.LC9:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L35
.L36:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L35:
	movl	-48(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L36
	movl	$0, -40(%rbp)
	jmp	.L37
.L38:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L37:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L38
	movq	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
	jmp	.L39
.L43:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L40
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	jmp	.L41
.L40:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L42
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	jmp	.L41
.L42:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L41:
	subl	$1, -36(%rbp)
.L39:
	cmpl	$0, -36(%rbp)
	jns	.L43
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC9(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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	StrLen
	.type	StrLen, @function
StrLen:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L5
.L2:
	addl	$1, -4(%rbp)
	jmp	.L4
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	StrLen, .-StrLen
	.globl	StrDel
	.type	StrDel, @function
StrDel:
.LFB7:
	.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)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	StrLen
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	cltq
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	subl	-28(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	StrDel, .-StrDel
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	NumDigits
	.type	NumDigits, @function
NumDigits:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %edx
	leaq	-32(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	NumDigits, .-NumDigits
	.section	.rodata
.LC1:
	.string	"%lld"
	.text
	.globl	NumDigitsLL
	.type	NumDigitsLL, @function
NumDigitsLL:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	NumDigitsLL, .-NumDigitsLL
	.globl	is1stAns
	.data
	.align 4
	.type	is1stAns, @object
	.size	is1stAns, 4
is1stAns:
	.long	1
	.section	.rodata
.LC2:
	.string	" %d"
	.text
	.globl	printI
	.type	printI, @function
printI:
.LFB10:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L17
.L15:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L17:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	printI, .-printI
	.section	.rodata
.LC3:
	.string	" %lld"
	.text
	.globl	printL
	.type	printL, @function
printL:
.LFB11:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L19
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L21
.L19:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	printL, .-printL
	.section	.rodata
.LC4:
	.string	"%.9f"
.LC5:
	.string	" %.9f"
	.text
	.globl	printD
	.type	printD, @function
printD:
.LFB12:
	.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
	movsd	%xmm0, -8(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L25
.L23:
	movq	-8(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L25:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	printD, .-printD
	.section	.rodata
.LC6:
	.string	" %c"
	.text
	.globl	printC
	.type	printC, @function
printC:
.LFB13:
	.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, %eax
	movb	%al, -4(%rbp)
	movl	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movsbl	-4(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L29
.L27:
	movsbl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L29:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	printC, .-printC
	.section	.rodata
.LC7:
	.string	"%s"
.LC8:
	.string	" %s"
	.text
	.globl	printS
	.type	printS, @function
printS:
.LFB14:
	.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	is1stAns(%rip), %eax
	testl	%eax, %eax
	je	.L31
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, is1stAns(%rip)
	jmp	.L33
.L31:
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L33:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	printS, .-printS
	.section	.rodata
.LC9:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	$9, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L35
.L36:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L35:
	movl	-48(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L36
	movl	$0, -40(%rbp)
	jmp	.L37
.L38:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L37:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L38
	movq	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
	jmp	.L39
.L43:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L40
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	jmp	.L41
.L40:
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L42
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	subq	%rcx, %rdx
	movq	%rdx, (%rax)
	jmp	.L41
.L42:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	addq	%rax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L41:
	subl	$1, -36(%rbp)
.L39:
	cmpl	$0, -36(%rbp)
	jns	.L43
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC9(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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:
