	.file	"769177.c"
	.intel_syntax noprefix
	.text
	.globl	MOD
	.bss
	.align 8
	.type	MOD, @object
	.size	MOD, 8
MOD:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld%lld%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rcx, -40[rbp]
	lea	rdx, -48[rbp]
	lea	rax, -56[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	rax, QWORD PTR -56[rbp]
	add	rax, 1
	mov	QWORD PTR MOD[rip], rax
	mov	rax, QWORD PTR MOD[rip]
	lea	rcx, -24[rbp]
	lea	rdx, -32[rbp]
	mov	rsi, rax
	mov	edi, 2
	call	exgcd
	mov	rax, QWORD PTR -32[rbp]
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	rax, QWORD PTR MOD[rip]
	add	rax, rdx
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	rax, rdx
	mov	QWORD PTR -32[rbp], rax
	mov	QWORD PTR -16[rbp], 1
	jmp	.L2
.L4:
	mov	rax, QWORD PTR -48[rbp]
	and	eax, 1
	test	rax, rax
	je	.L3
	mov	rdx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	mul
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	QWORD PTR -16[rbp], rdx
.L3:
	mov	rdx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	mul
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	rax, rdx
	mov	QWORD PTR -32[rbp], rax
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, rax
	shr	rdx, 63
	add	rax, rdx
	sar	rax
	mov	QWORD PTR -48[rbp], rax
.L2:
	mov	rax, QWORD PTR -48[rbp]
	test	rax, rax
	jne	.L4
	mov	rax, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -16[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	mul
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 40
	.cfi_offset 3, -24
	mov	QWORD PTR -24[rbp], rdi
	mov	QWORD PTR -32[rbp], rsi
	mov	QWORD PTR -40[rbp], rdx
	mov	QWORD PTR -48[rbp], rcx
	cmp	QWORD PTR -32[rbp], 0
	jne	.L8
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR [rax], 1
	mov	rax, QWORD PTR -48[rbp]
	mov	QWORD PTR [rax], 0
	jmp	.L10
.L8:
	mov	rax, QWORD PTR -24[rbp]
	cqo
	idiv	QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rcx, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -48[rbp]
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	exgcd
	mov	rax, QWORD PTR -48[rbp]
	mov	rbx, QWORD PTR [rax]
	mov	rax, QWORD PTR -40[rbp]
	mov	rcx, QWORD PTR [rax]
	mov	rax, QWORD PTR -24[rbp]
	cqo
	idiv	QWORD PTR -32[rbp]
	mov	rsi, rcx
	mov	rdi, rax
	call	mul
	mov	rdx, rax
	mov	rax, rbx
	sub	rax, rdx
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	rax, QWORD PTR -48[rbp]
	mov	QWORD PTR [rax], rdx
.L10:
	nop
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	exgcd, .-exgcd
	.globl	mul
	.type	mul, @function
mul:
.LFB2:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -24[rbp], rdi
	mov	QWORD PTR -32[rbp], rsi
	mov	QWORD PTR -8[rbp], 0
	jmp	.L12
.L14:
	mov	rax, QWORD PTR -32[rbp]
	and	eax, 1
	test	rax, rax
	je	.L13
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	QWORD PTR -8[rbp], rdx
.L13:
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rax
	mov	rcx, QWORD PTR MOD[rip]
	cqo
	idiv	rcx
	mov	QWORD PTR -24[rbp], rdx
	mov	rax, QWORD PTR -32[rbp]
	mov	rdx, rax
	shr	rdx, 63
	add	rax, rdx
	sar	rax
	mov	QWORD PTR -32[rbp], rax
.L12:
	cmp	QWORD PTR -32[rbp], 0
	jne	.L14
	mov	rax, QWORD PTR -8[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	mul, .-mul
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"769177.c"
	.text
	.comm	MOD,8,8
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%lld%lld%lld\000"
	.global	__aeabi_ldivmod
	.align	2
.LC1:
	.ascii	"%lld\012\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, fp, lr}
	add	fp, sp, #28
	sub	sp, sp, #72
	ldr	r3, .L7
	ldr	r3, [r3]
	str	r3, [fp, #-32]
	mov	r3,#0
	sub	r3, fp, #68
	sub	r2, fp, #76
	sub	r1, fp, #84
	ldr	r0, .L7+4
	bl	__isoc99_scanf
	sub	r3, fp, #84
	ldmia	r3, {r2-r3}
	adds	r8, r2, #1
	adc	r9, r3, #0
	ldr	r3, .L7+8
	stm	r3, {r8-r9}
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	sub	r1, fp, #52
	str	r1, [sp, #4]
	sub	r1, fp, #60
	str	r1, [sp]
	mov	r0, #2
	mov	r1, #0
	bl	exgcd
	sub	r1, fp, #60
	ldmia	r1, {r0-r1}
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	mov	r0, r2
	mov	r1, r3
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	adds	ip, r0, r2
	str	ip, [fp, #-92]
	adc	r3, r1, r3
	str	r3, [fp, #-88]
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	sub	r1, fp, #92
	ldmia	r1, {r0-r1}
	bl	__aeabi_ldivmod
	str	r2, [fp, #-60]
	str	r3, [fp, #-56]
	mov	r2, #1
	mov	r3, #0
	str	r2, [fp, #-44]
	str	r3, [fp, #-40]
	b	.L2
.L4:
	sub	r3, fp, #76
	ldmia	r3, {r2-r3}
	mov	r0, #1
	mov	r1, #0
	and	r6, r2, r0
	and	r7, r3, r1
	orrs	r3, r6, r7
	beq	.L3
	sub	r3, fp, #60
	ldmia	r3, {r2-r3}
	sub	r1, fp, #44
	ldmia	r1, {r0-r1}
	bl	mul
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	str	r2, [fp, #-44]
	str	r3, [fp, #-40]
.L3:
	sub	r1, fp, #60
	ldmia	r1, {r0-r1}
	sub	r3, fp, #60
	ldmia	r3, {r2-r3}
	bl	mul
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	str	r2, [fp, #-60]
	str	r3, [fp, #-56]
	sub	r3, fp, #76
	ldmia	r3, {r2-r3}
	lsr	r1, r3, #31
	mov	r0, r1
	mov	r1, #0
	adds	r4, r0, r2
	adc	r5, r1, r3
	mov	r2, #0
	mov	r3, #0
	lsr	r2, r4, #1
	orr	r2, r2, r5, lsl #31
	asr	r3, r5, #1
	str	r2, [fp, #-76]
	str	r3, [fp, #-72]
.L2:
	sub	r3, fp, #76
	ldmia	r3, {r2-r3}
	orrs	r3, r2, r3
	bne	.L4
	sub	r1, fp, #68
	ldmia	r1, {r0-r1}
	sub	r3, fp, #44
	ldmia	r3, {r2-r3}
	bl	mul
	ldr	r3, .L7+8
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	ldr	r0, .L7+12
	bl	printf
	mov	r3, #0
	ldr	r2, .L7
	ldr	r1, [r2]
	ldr	r2, [fp, #-32]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L6
	bl	__stack_chk_fail
.L6:
	mov	r0, r3
	sub	sp, fp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, fp, pc}
.L8:
	.align	2
.L7:
	.word	.LC2
	.word	.LC0
	.word	MOD
	.word	.LC1
	.size	main, .-main
	.align	2
	.global	exgcd
	.syntax unified
	.arm
	.fpu softvfp
	.type	exgcd, %function
exgcd:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, fp, lr}
	add	fp, sp, #20
	sub	sp, sp, #24
	str	r0, [fp, #-28]
	str	r1, [fp, #-24]
	str	r2, [fp, #-36]
	str	r3, [fp, #-32]
	sub	r3, fp, #36
	ldmia	r3, {r2-r3}
	orrs	r3, r2, r3
	bne	.L10
	ldr	r1, [fp, #4]
	mov	r2, #1
	mov	r3, #0
	stm	r1, {r2-r3}
	ldr	r1, [fp, #8]
	mov	r2, #0
	mov	r3, #0
	stm	r1, {r2-r3}
	b	.L12
.L10:
	sub	r1, fp, #28
	ldmia	r1, {r0-r1}
	sub	r3, fp, #36
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	mov	r0, r2
	mov	r1, r3
	ldr	r3, [fp, #4]
	str	r3, [sp, #4]
	ldr	r3, [fp, #8]
	str	r3, [sp]
	mov	r2, r0
	mov	r3, r1
	sub	r1, fp, #36
	ldmia	r1, {r0-r1}
	bl	exgcd
	ldr	r3, [fp, #8]
	ldmia	r3, {r4-r5}
	sub	r3, fp, #36
	ldmia	r3, {r2-r3}
	sub	r1, fp, #28
	ldmia	r1, {r0-r1}
	bl	__aeabi_ldivmod
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	ldr	r3, [fp, #4]
	ldmia	r3, {r2-r3}
	bl	mul
	mov	r2, r0
	mov	r3, r1
	subs	r6, r4, r2
	sbc	r7, r5, r3
	ldr	r3, .L13
	ldmia	r3, {r2-r3}
	mov	r0, r6
	mov	r1, r7
	bl	__aeabi_ldivmod
	ldr	r1, [fp, #8]
	stm	r1, {r2-r3}
.L12:
	nop
	sub	sp, fp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, fp, pc}
.L14:
	.align	2
.L13:
	.word	MOD
	.size	exgcd, .-exgcd
	.align	2
	.global	mul
	.syntax unified
	.arm
	.fpu softvfp
	.type	mul, %function
mul:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, fp, lr}
	add	fp, sp, #28
	sub	sp, sp, #32
	str	r0, [fp, #-44]
	str	r1, [fp, #-40]
	str	r2, [fp, #-52]
	str	r3, [fp, #-48]
	mov	r2, #0
	mov	r3, #0
	str	r2, [fp, #-36]
	str	r3, [fp, #-32]
	b	.L16
.L18:
	sub	r3, fp, #52
	ldmia	r3, {r2-r3}
	mov	r0, #1
	mov	r1, #0
	and	r6, r2, r0
	and	r7, r3, r1
	orrs	r3, r6, r7
	beq	.L17
	sub	r1, fp, #36
	ldmia	r1, {r0-r1}
	sub	r3, fp, #44
	ldmia	r3, {r2-r3}
	adds	r8, r0, r2
	adc	r9, r1, r3
	ldr	r3, .L20
	ldmia	r3, {r2-r3}
	mov	r0, r8
	mov	r1, r9
	bl	__aeabi_ldivmod
	str	r2, [fp, #-36]
	str	r3, [fp, #-32]
.L17:
	sub	r3, fp, #44
	ldmia	r3, {r2-r3}
	adds	r1, r2, r2
	str	r1, [fp, #-60]
	adc	r3, r3, r3
	str	r3, [fp, #-56]
	sub	r1, fp, #60
	ldmia	r1, {r0-r1}
	ldr	r3, .L20
	ldmia	r3, {r2-r3}
	bl	__aeabi_ldivmod
	str	r2, [fp, #-44]
	str	r3, [fp, #-40]
	sub	r3, fp, #52
	ldmia	r3, {r2-r3}
	lsr	r1, r3, #31
	mov	r0, r1
	mov	r1, #0
	adds	r4, r0, r2
	adc	r5, r1, r3
	mov	r2, #0
	mov	r3, #0
	lsr	r2, r4, #1
	orr	r2, r2, r5, lsl #31
	asr	r3, r5, #1
	str	r2, [fp, #-52]
	str	r3, [fp, #-48]
.L16:
	sub	r3, fp, #52
	ldmia	r3, {r2-r3}
	orrs	r3, r2, r3
	bne	.L18
	sub	r3, fp, #36
	ldmia	r3, {r2-r3}
	mov	r0, r2
	mov	r1, r3
	sub	sp, fp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, fp, pc}
.L21:
	.align	2
.L20:
	.word	MOD
	.size	mul, .-mul
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
