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

```c
// AOJ 	2509: Sim Forest 2013
// 2018.1.3 bal4u@uu

#include <stdio.h>
#include <math.h>

char *s_time[3] = {"Day", "Night", "All"};
int id_time[3] = {0,1,2}, len_time[3] = {4,6,4};
int tr_time['Z'];

int tbl[3][2][20160];		// day/night/all, weekday/all, 20160 = 2*7*24*60

char buf[50], *bp;

int in()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	bp++;
	return n;
}

int main()
{
	int s, n, t, weekday, time, p, m, i, j, k, lim, cnt, ans;

	for (i = 0; i < 3; i++) bp = s_time[i], tr_time[*bp] = id_time[i];

	// imos method
	tbl[0][0][ 6*60+1] = 1, tbl[0][0][18*60+1] = -1;		// day    6:00-18:00
	tbl[1][0][18*60+1] = 1, tbl[1][0][24*60+1] = -1;		// night 18:00-24:00
	tbl[1][0][      1] = 1, tbl[1][0][ 6*60+1] = -1;		// night  0:00- 6:00
	tbl[2][0][      1] = 1, tbl[2][0][24*60+1] = -1;		// all    0:00-24:00

	for (i = 0; i < 3; i++) for (j = 0; j <= 24*60+2; j++) tbl[i][0][j+1] += tbl[i][0][j];

	// for all weekday
	for (i = 0; i < 3; i++) for (j = 0; j < 24*60; j++) for (t = 0, k = 0; k < 7; k++, t += 24*60)
		tbl[i][1][j+t] = tbl[i][0][j];
	
	while (1) {
		fgets(bp=buf, 50, stdin);
		s = in(), n = in(), t = in();
		if (*bp == 'N') break;				// None -> exit
		weekday = (*bp == 'A'),  bp += 4;
		time = tr_time[*bp],     bp += len_time[time];
		p = in(), m = in();

		lim = 1444;	if (weekday) lim = 10085;	// 10085 = 7*24*60+5
		ans = 0;
		for (i = 0; i < lim; i++) {
			cnt = 0;
			for (k = i, j = 0; j < m; j++, k += t) {
				if (tbl[time][weekday][k % 10080] && tbl[time][weekday][(k+s) % 10080]) cnt++;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%.10lf\n", 1-pow(1-1.0/p, ans*n));
	}
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s_time
	.section	.rodata
.LC0:
	.string	"Day"
.LC1:
	.string	"Night"
.LC2:
	.string	"All"
	.section	.data.rel.local,"aw"
	.align 16
	.type	s_time, @object
	.size	s_time, 24
s_time:
	.quad	.LC0
	.quad	.LC1
	.quad	.LC2
	.globl	id_time
	.data
	.align 8
	.type	id_time, @object
	.size	id_time, 12
id_time:
	.long	0
	.long	1
	.long	2
	.globl	len_time
	.align 8
	.type	len_time, @object
	.size	len_time, 12
len_time:
	.long	4
	.long	6
	.long	4
	.globl	tr_time
	.bss
	.align 32
	.type	tr_time, @object
	.size	tr_time, 360
tr_time:
	.zero	360
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 483840
tbl:
	.zero	483840
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	bp
	.align 8
	.type	bp, @object
	.size	bp, 8
bp:
	.zero	8
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	bp(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, bp(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	bp(%rip), %rax
	addq	$1, %rax
	movq	%rax, bp(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.section	.rodata
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	$0, -48(%rbp)
	jmp	.L6
.L7:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	s_time(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	id_time(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tr_time(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -48(%rbp)
.L6:
	cmpl	$2, -48(%rbp)
	jle	.L7
	movl	$1, 1444+tbl(%rip)
	movl	$-1, 4324+tbl(%rip)
	movl	$1, 165604+tbl(%rip)
	movl	$-1, 167044+tbl(%rip)
	movl	$1, 161284+tbl(%rip)
	movl	$-1, 162724+tbl(%rip)
	movl	$1, 322564+tbl(%rip)
	movl	$-1, 328324+tbl(%rip)
	movl	$0, -48(%rbp)
	jmp	.L8
.L11:
	movl	$0, -44(%rbp)
	jmp	.L9
.L10:
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	addl	$1, %eax
	addl	%edx, %ecx
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -44(%rbp)
.L9:
	cmpl	$1442, -44(%rbp)
	jle	.L10
	addl	$1, -48(%rbp)
.L8:
	cmpl	$2, -48(%rbp)
	jle	.L11
	movl	$0, -48(%rbp)
	jmp	.L12
.L17:
	movl	$0, -44(%rbp)
	jmp	.L13
.L16:
	movl	$0, -52(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L14
.L15:
	movl	-44(%rbp), %edx
	movl	-52(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rcx
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$40320, %rdx, %rdx
	addq	%rcx, %rdx
	addq	$20160, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
	addl	$1440, -52(%rbp)
.L14:
	cmpl	$6, -40(%rbp)
	jle	.L15
	addl	$1, -44(%rbp)
.L13:
	cmpl	$1439, -44(%rbp)
	jle	.L16
	addl	$1, -48(%rbp)
.L12:
	cmpl	$2, -48(%rbp)
	jle	.L17
.L27:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -20(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -52(%rbp)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$78, %al
	je	.L30
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -16(%rbp)
	movq	bp(%rip), %rax
	addq	$4, %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movq	bp(%rip), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	len_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	movq	%rax, bp(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	$1444, -36(%rbp)
	cmpl	$0, -16(%rbp)
	je	.L20
	movl	$10085, -36(%rbp)
.L20:
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L22
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	addl	$1, -32(%rbp)
.L23:
	addl	$1, -44(%rbp)
	movl	-52(%rbp), %eax
	addl	%eax, -40(%rbp)
.L22:
	movl	-44(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L25
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L25:
	addl	$1, -48(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L26
	movl	-28(%rbp), %eax
	imull	-20(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-8(%rbp), %xmm2
	movsd	.LC3(%rip), %xmm0
	movapd	%xmm0, %xmm1
	divsd	%xmm2, %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movapd	%xmm3, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movsd	.LC3(%rip), %xmm1
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.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	in
	.type	in, @function
in:
.LFB23:
	.cfi_startproc
	endbr64
	movq	bp(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, bp(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, bp(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	in, .-in
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%.10lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	tr_time(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movq	s_time(%rip), %rax
	movl	id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	%edx, (%rbx,%rax,4)
	movq	8+s_time(%rip), %rax
	movl	4+id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	%edx, (%rbx,%rax,4)
	movq	16+s_time(%rip), %rax
	movl	8+id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	$1, 1444+tbl(%rip)
	movl	%edx, (%rbx,%rax,4)
	leaq	tbl(%rip), %rbx
	movl	$-1, 4324+tbl(%rip)
	movq	%rbx, %r8
	leaq	5776(%rbx), %rcx
	movl	$1, 165604+tbl(%rip)
	leaq	483840(%rcx), %rsi
	movl	$-1, 167044+tbl(%rip)
	movl	$1, 161284+tbl(%rip)
	movl	$-1, 162724+tbl(%rip)
	movl	$1, 322564+tbl(%rip)
	movl	$-1, 328324+tbl(%rip)
.L8:
	movl	-5776(%rcx), %edx
	leaq	-5772(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L9:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L9
	leaq	161280(%rax), %rcx
	cmpq	%rsi, %rcx
	jne	.L8
	leaq	483840+tbl(%rip), %r9
.L11:
	leaq	80648(%r8), %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	movq	%r8, %rsi
	leaq	80640(%r8), %rax
	andq	$-8, %rdi
	leaq	86408(%r8), %r11
	subq	%rdi, %rax
	movq	%rcx, 86392(%r8)
	leaq	92168(%r8), %rbp
	leal	5760(%rax), %ecx
	movq	%rdx, 80640(%r8)
	subq	%rax, %rsi
	leaq	86400(%r8), %rdx
	shrl	$3, %ecx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	leaq	97928(%r8), %r11
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rcx, 92152(%r8)
	leal	5760(%rdx), %ecx
	movq	%rax, 86400(%r8)
	shrl	$3, %ecx
	leaq	92160(%r8), %rax
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	leaq	103688(%r8), %rbp
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	subq	%rdi, %rax
	subq	%rax, %rsi
	movq	%rcx, 97912(%r8)
	leal	5760(%rax), %ecx
	movq	%rdx, 92160(%r8)
	shrl	$3, %ecx
	leaq	97920(%r8), %rdx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	leaq	109448(%r8), %r11
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rcx, 103672(%r8)
	leal	5760(%rdx), %ecx
	movq	%rax, 97920(%r8)
	shrl	$3, %ecx
	leaq	103680(%r8), %rax
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	leaq	115208(%r8), %rbp
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	subq	%rdi, %rax
	subq	%rax, %rsi
	movq	%rcx, 109432(%r8)
	leal	5760(%rax), %ecx
	movq	%rdx, 103680(%r8)
	shrl	$3, %ecx
	leaq	109440(%r8), %rdx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	andq	$-8, %rdi
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rax, 109440(%r8)
	movq	5752(%r8), %rcx
	leaq	115200(%r8), %rax
	movq	%rcx, 115192(%r8)
	leal	5760(%rdx), %ecx
	shrl	$3, %ecx
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	addq	$161280, %r8
	andq	$-8, %rdi
	movq	-161280(%r8), %rdx
	subq	%rdi, %rax
	leal	5760(%rax), %ecx
	subq	%rax, %rsi
	movq	%rdx, -46080(%r8)
	movq	-155528(%r8), %rdx
	shrl	$3, %ecx
	movq	%rdx, -40328(%r8)
	rep movsq
	cmpq	%r9, %r8
	jne	.L11
.L29:
	leaq	buf(%rip), %rax
	movq	stdin(%rip), %rdx
	movl	$50, %esi
	movq	%rax, %rdi
	movq	%rax, bp(%rip)
	call	fgets@PLT
	movq	bp(%rip), %rax
	xorl	%r10d, %r10d
	cmpb	$47, (%rax)
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	leal	(%r10,%r10,4), %ecx
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rcx,2), %r10d
	jg	.L13
.L12:
	leaq	1(%rax), %rsi
	movq	%rsi, bp(%rip)
	cmpb	$47, 1(%rax)
	jle	.L31
	addq	$2, %rax
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	0(%rbp,%rbp,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ebp
	jg	.L15
.L14:
	leaq	1(%rsi), %rdx
	xorl	%r8d, %r8d
	movq	%rdx, bp(%rip)
	cmpb	$47, 1(%rsi)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rdx
	leal	(%r8,%r8,4), %ecx
	movq	%rdx, bp(%rip)
	movzbl	-1(%rdx), %eax
	andl	$15, %eax
	cmpb	$47, (%rdx)
	leal	(%rax,%rcx,2), %r8d
	jg	.L17
.L16:
	leaq	1(%rdx), %rax
	movq	%rax, bp(%rip)
	movzbl	1(%rdx), %r9d
	cmpb	$78, %r9b
	je	.L18
	leaq	5(%rdx), %rax
	leaq	tr_time(%rip), %rsi
	xorl	%ecx, %ecx
	cmpb	$65, %r9b
	movq	%rax, bp(%rip)
	movsbq	5(%rdx), %rdx
	leaq	len_time(%rip), %rdi
	sete	%cl
	movslq	(%rsi,%rdx,4), %rsi
	movslq	(%rdi,%rsi,4), %rdx
	addq	%rdx, %rax
	movq	%rax, bp(%rip)
	cmpb	$47, (%rax)
	jle	.L33
	leaq	1(%rax), %rdi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdi, bp(%rip)
	leal	(%rdx,%rdx,4), %r11d
	movzbl	-1(%rdi), %edx
	movq	%rdi, %rax
	leaq	1(%rdi), %rdi
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%r11,2), %edx
	jg	.L20
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
.L19:
	leaq	1(%rax), %r11
	movq	%r11, bp(%rip)
	cmpb	$47, 1(%rax)
	jle	.L34
	addq	$2, %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %r11
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %edi
	jg	.L22
.L21:
	addq	$1, %r11
	movl	$1444, %eax
	cmpb	$65, %r9b
	movl	$10085, %r13d
	cmovne	%eax, %r13d
	movslq	%ecx, %rax
	movq	%r11, bp(%rip)
	xorl	%r12d, %r12d
	imulq	$40320, %rsi, %rsi
	xorl	%r11d, %r11d
	imulq	$20160, %rax, %rax
	addq	%rax, %rsi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%r11d, %edx
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	testl	%edi, %edi
	jle	.L28
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%edx, %rax
	movl	%edx, %r14d
	imulq	$-804454191, %rax, %rax
	sarl	$31, %r14d
	shrq	$32, %rax
	addl	%edx, %eax
	sarl	$13, %eax
	subl	%r14d, %eax
	movl	%edx, %r14d
	imull	$10080, %eax, %eax
	subl	%eax, %r14d
	movslq	%r14d, %rax
	addq	%rsi, %rax
	movl	(%rbx,%rax,4), %eax
	testl	%eax, %eax
	je	.L25
	leal	(%r10,%rdx), %r14d
	movslq	%r14d, %rax
	movl	%r14d, %r15d
	imulq	$-804454191, %rax, %rax
	sarl	$31, %r15d
	shrq	$32, %rax
	addl	%r14d, %eax
	sarl	$13, %eax
	subl	%r15d, %eax
	imull	$10080, %eax, %eax
	subl	%eax, %r14d
	movslq	%r14d, %r14
	addq	%rsi, %r14
	cmpl	$1, (%rbx,%r14,4)
	sbbl	$-1, %r9d
.L25:
	addl	$1, %ecx
	addl	%r8d, %edx
	cmpl	%edi, %ecx
	jne	.L26
.L28:
	cmpl	%r9d, %r12d
	cmovl	%r9d, %r12d
	addl	$1, %r11d
	cmpl	%r11d, %r13d
	jne	.L24
	movsd	.LC1(%rip), %xmm1
	imull	%r12d, %ebp
	divsd	%xmm0, %xmm1
	movsd	.LC1(%rip), %xmm0
	subsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%ebp, %xmm1
	call	pow@PLT
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC2(%rip), %rsi
	movapd	%xmm0, %xmm1
	movsd	.LC1(%rip), %xmm0
	subsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	jmp	.L29
.L34:
	xorl	%edi, %edi
	jmp	.L21
.L33:
	pxor	%xmm0, %xmm0
	jmp	.L19
.L18:
	addq	$8, %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
.L31:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L14
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	bp
	.bss
	.align 8
	.type	bp, @object
	.size	bp, 8
bp:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 483840
tbl:
	.zero	483840
	.globl	tr_time
	.align 32
	.type	tr_time, @object
	.size	tr_time, 360
tr_time:
	.zero	360
	.globl	len_time
	.data
	.align 8
	.type	len_time, @object
	.size	len_time, 12
len_time:
	.long	4
	.long	6
	.long	4
	.globl	id_time
	.align 8
	.type	id_time, @object
	.size	id_time, 12
id_time:
	.long	0
	.long	1
	.long	2
	.globl	s_time
	.section	.rodata.str1.1
.LC3:
	.string	"Day"
.LC4:
	.string	"Night"
.LC5:
	.string	"All"
	.section	.data.rel.local,"aw"
	.align 16
	.type	s_time, @object
	.size	s_time, 24
s_time:
	.quad	.LC3
	.quad	.LC4
	.quad	.LC5
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.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	in
	.type	in, @function
in:
.LFB23:
	.cfi_startproc
	endbr64
	movq	bp(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L4
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L3
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, bp(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, bp(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	in, .-in
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%.10lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	tr_time(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movq	s_time(%rip), %rax
	movl	id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	%edx, (%rbx,%rax,4)
	movq	8+s_time(%rip), %rax
	movl	4+id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	%edx, (%rbx,%rax,4)
	movq	16+s_time(%rip), %rax
	movl	8+id_time(%rip), %edx
	movq	%rax, bp(%rip)
	movsbq	(%rax), %rax
	movl	$1, 1444+tbl(%rip)
	movl	%edx, (%rbx,%rax,4)
	leaq	tbl(%rip), %rbx
	movl	$-1, 4324+tbl(%rip)
	movq	%rbx, %r8
	leaq	5776(%rbx), %rcx
	movl	$1, 165604+tbl(%rip)
	leaq	483840(%rcx), %rsi
	movl	$-1, 167044+tbl(%rip)
	movl	$1, 161284+tbl(%rip)
	movl	$-1, 162724+tbl(%rip)
	movl	$1, 322564+tbl(%rip)
	movl	$-1, 328324+tbl(%rip)
.L8:
	movl	-5776(%rcx), %edx
	leaq	-5772(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L9:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L9
	leaq	161280(%rax), %rcx
	cmpq	%rsi, %rcx
	jne	.L8
	leaq	483840+tbl(%rip), %r9
.L11:
	leaq	80648(%r8), %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	movq	%r8, %rsi
	leaq	80640(%r8), %rax
	andq	$-8, %rdi
	leaq	86408(%r8), %r11
	subq	%rdi, %rax
	movq	%rcx, 86392(%r8)
	leaq	92168(%r8), %rbp
	leal	5760(%rax), %ecx
	movq	%rdx, 80640(%r8)
	subq	%rax, %rsi
	leaq	86400(%r8), %rdx
	shrl	$3, %ecx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	leaq	97928(%r8), %r11
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rcx, 92152(%r8)
	leal	5760(%rdx), %ecx
	movq	%rax, 86400(%r8)
	shrl	$3, %ecx
	leaq	92160(%r8), %rax
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	leaq	103688(%r8), %rbp
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	subq	%rdi, %rax
	subq	%rax, %rsi
	movq	%rcx, 97912(%r8)
	leal	5760(%rax), %ecx
	movq	%rdx, 92160(%r8)
	shrl	$3, %ecx
	leaq	97920(%r8), %rdx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	leaq	109448(%r8), %r11
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rcx, 103672(%r8)
	leal	5760(%rdx), %ecx
	movq	%rax, 97920(%r8)
	shrl	$3, %ecx
	leaq	103680(%r8), %rax
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	leaq	115208(%r8), %rbp
	andq	$-8, %rdi
	movq	5752(%r8), %rcx
	movq	(%r8), %rdx
	subq	%rdi, %rax
	subq	%rax, %rsi
	movq	%rcx, 109432(%r8)
	leal	5760(%rax), %ecx
	movq	%rdx, 103680(%r8)
	shrl	$3, %ecx
	leaq	109440(%r8), %rdx
	rep movsq
	movq	%r11, %rdi
	movq	%r8, %rsi
	andq	$-8, %rdi
	movq	(%r8), %rax
	subq	%rdi, %rdx
	subq	%rdx, %rsi
	movq	%rax, 109440(%r8)
	movq	5752(%r8), %rcx
	leaq	115200(%r8), %rax
	movq	%rcx, 115192(%r8)
	leal	5760(%rdx), %ecx
	shrl	$3, %ecx
	rep movsq
	movq	%rbp, %rdi
	movq	%r8, %rsi
	addq	$161280, %r8
	andq	$-8, %rdi
	movq	-161280(%r8), %rdx
	subq	%rdi, %rax
	leal	5760(%rax), %ecx
	subq	%rax, %rsi
	movq	%rdx, -46080(%r8)
	movq	-155528(%r8), %rdx
	shrl	$3, %ecx
	movq	%rdx, -40328(%r8)
	rep movsq
	cmpq	%r9, %r8
	jne	.L11
.L29:
	leaq	buf(%rip), %rax
	movq	stdin(%rip), %rdx
	movl	$50, %esi
	movq	%rax, %rdi
	movq	%rax, bp(%rip)
	call	fgets@PLT
	movq	bp(%rip), %rax
	xorl	%r10d, %r10d
	cmpb	$47, (%rax)
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	leal	(%r10,%r10,4), %ecx
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rcx,2), %r10d
	jg	.L13
.L12:
	leaq	1(%rax), %rsi
	movq	%rsi, bp(%rip)
	cmpb	$47, 1(%rax)
	jle	.L31
	addq	$2, %rax
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	0(%rbp,%rbp,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ebp
	jg	.L15
.L14:
	leaq	1(%rsi), %rdx
	xorl	%r8d, %r8d
	movq	%rdx, bp(%rip)
	cmpb	$47, 1(%rsi)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rdx
	leal	(%r8,%r8,4), %ecx
	movq	%rdx, bp(%rip)
	movzbl	-1(%rdx), %eax
	andl	$15, %eax
	cmpb	$47, (%rdx)
	leal	(%rax,%rcx,2), %r8d
	jg	.L17
.L16:
	leaq	1(%rdx), %rax
	movq	%rax, bp(%rip)
	movzbl	1(%rdx), %r9d
	cmpb	$78, %r9b
	je	.L18
	leaq	5(%rdx), %rax
	leaq	tr_time(%rip), %rsi
	xorl	%ecx, %ecx
	cmpb	$65, %r9b
	movq	%rax, bp(%rip)
	movsbq	5(%rdx), %rdx
	leaq	len_time(%rip), %rdi
	sete	%cl
	movslq	(%rsi,%rdx,4), %rsi
	movslq	(%rdi,%rsi,4), %rdx
	addq	%rdx, %rax
	movq	%rax, bp(%rip)
	cmpb	$47, (%rax)
	jle	.L33
	leaq	1(%rax), %rdi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdi, bp(%rip)
	leal	(%rdx,%rdx,4), %r11d
	movzbl	-1(%rdi), %edx
	movq	%rdi, %rax
	leaq	1(%rdi), %rdi
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%r11,2), %edx
	jg	.L20
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
.L19:
	leaq	1(%rax), %r11
	movq	%r11, bp(%rip)
	cmpb	$47, 1(%rax)
	jle	.L34
	addq	$2, %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, bp(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %r11
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rax
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %edi
	jg	.L22
.L21:
	addq	$1, %r11
	movl	$1444, %eax
	cmpb	$65, %r9b
	movl	$10085, %r13d
	cmovne	%eax, %r13d
	movslq	%ecx, %rax
	movq	%r11, bp(%rip)
	xorl	%r12d, %r12d
	imulq	$40320, %rsi, %rsi
	xorl	%r11d, %r11d
	imulq	$20160, %rax, %rax
	addq	%rax, %rsi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%r11d, %edx
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	testl	%edi, %edi
	jle	.L28
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%edx, %rax
	movl	%edx, %r14d
	imulq	$-804454191, %rax, %rax
	sarl	$31, %r14d
	shrq	$32, %rax
	addl	%edx, %eax
	sarl	$13, %eax
	subl	%r14d, %eax
	movl	%edx, %r14d
	imull	$10080, %eax, %eax
	subl	%eax, %r14d
	movslq	%r14d, %rax
	addq	%rsi, %rax
	movl	(%rbx,%rax,4), %eax
	testl	%eax, %eax
	je	.L25
	leal	(%r10,%rdx), %r14d
	movslq	%r14d, %rax
	movl	%r14d, %r15d
	imulq	$-804454191, %rax, %rax
	sarl	$31, %r15d
	shrq	$32, %rax
	addl	%r14d, %eax
	sarl	$13, %eax
	subl	%r15d, %eax
	imull	$10080, %eax, %eax
	subl	%eax, %r14d
	movslq	%r14d, %r14
	addq	%rsi, %r14
	cmpl	$1, (%rbx,%r14,4)
	sbbl	$-1, %r9d
.L25:
	addl	$1, %ecx
	addl	%r8d, %edx
	cmpl	%edi, %ecx
	jne	.L26
.L28:
	cmpl	%r9d, %r12d
	cmovl	%r9d, %r12d
	addl	$1, %r11d
	cmpl	%r11d, %r13d
	jne	.L24
	movsd	.LC1(%rip), %xmm1
	imull	%r12d, %ebp
	divsd	%xmm0, %xmm1
	movsd	.LC1(%rip), %xmm0
	subsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%ebp, %xmm1
	call	pow@PLT
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC2(%rip), %rsi
	movapd	%xmm0, %xmm1
	movsd	.LC1(%rip), %xmm0
	subsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	jmp	.L29
.L34:
	xorl	%edi, %edi
	jmp	.L21
.L33:
	pxor	%xmm0, %xmm0
	jmp	.L19
.L18:
	addq	$8, %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
.L31:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L14
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	bp
	.bss
	.align 8
	.type	bp, @object
	.size	bp, 8
bp:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 483840
tbl:
	.zero	483840
	.globl	tr_time
	.align 32
	.type	tr_time, @object
	.size	tr_time, 360
tr_time:
	.zero	360
	.globl	len_time
	.data
	.align 8
	.type	len_time, @object
	.size	len_time, 12
len_time:
	.long	4
	.long	6
	.long	4
	.globl	id_time
	.align 8
	.type	id_time, @object
	.size	id_time, 12
id_time:
	.long	0
	.long	1
	.long	2
	.globl	s_time
	.section	.rodata.str1.1
.LC3:
	.string	"Day"
.LC4:
	.string	"Night"
.LC5:
	.string	"All"
	.section	.data.rel.local,"aw"
	.align 16
	.type	s_time, @object
	.size	s_time, 24
s_time:
	.quad	.LC3
	.quad	.LC4
	.quad	.LC5
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.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:

// AOJ 	2509: Sim Forest 2013
// 2018.1.3 bal4u@uu

#include <stdio.h>
#include <math.h>

char *s_time[3] = {"Day", "Night", "All"};
int id_time[3] = {0,1,2}, len_time[3] = {4,6,4};
int tr_time['Z'];

int tbl[3][2][20160];		// day/night/all, weekday/all, 20160 = 2*7*24*60

char buf[50], *bp;

int in()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	bp++;
	return n;
}

int main()
{
	int s, n, t, weekday, time, p, m, i, j, k, lim, cnt, ans;

	for (i = 0; i < 3; i++) bp = s_time[i], tr_time[*bp] = id_time[i];

	// imos method
	tbl[0][0][ 6*60+1] = 1, tbl[0][0][18*60+1] = -1;		// day    6:00-18:00
	tbl[1][0][18*60+1] = 1, tbl[1][0][24*60+1] = -1;		// night 18:00-24:00
	tbl[1][0][      1] = 1, tbl[1][0][ 6*60+1] = -1;		// night  0:00- 6:00
	tbl[2][0][      1] = 1, tbl[2][0][24*60+1] = -1;		// all    0:00-24:00

	for (i = 0; i < 3; i++) for (j = 0; j <= 24*60+2; j++) tbl[i][0][j+1] += tbl[i][0][j];

	// for all weekday
	for (i = 0; i < 3; i++) for (j = 0; j < 24*60; j++) for (t = 0, k = 0; k < 7; k++, t += 24*60)
		tbl[i][1][j+t] = tbl[i][0][j];
	
	while (1) {
		fgets(bp=buf, 50, stdin);
		s = in(), n = in(), t = in();
		if (*bp == 'N') break;				// None -> exit
		weekday = (*bp == 'A'),  bp += 4;
		time = tr_time[*bp],     bp += len_time[time];
		p = in(), m = in();

		lim = 1444;	if (weekday) lim = 10085;	// 10085 = 7*24*60+5
		ans = 0;
		for (i = 0; i < lim; i++) {
			cnt = 0;
			for (k = i, j = 0; j < m; j++, k += t) {
				if (tbl[time][weekday][k % 10080] && tbl[time][weekday][(k+s) % 10080]) cnt++;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%.10lf\n", 1-pow(1-1.0/p, ans*n));
	}
	return 0;
}


1 1 3 All All 1 1
2 37 2 All Night 150 1
16 2 20 All Day 5 10
1 14 15 Mon All 20000 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
3 37 2 All Night 150 1
18 2 19 All Day 5 10
1 14 15 Mno All 23674 100
0 0 0 None None 0 0
 2 1 3 Alm All 1 1
3 37 2 All Nifht 150 1
18 2 19 All Eay 5 10
1 14 22 Nnn All 23674 100
0 0 0 None None 0 0
 1 1 3 All All 1 1
2 22 2 All Night 150 1
16 2 20 All Day 5 10
1 14 15 Mon All 20000 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
2 49 2 All Night 150 1
18 2 19 All Day 5 10
1 14 15 Mon All 20000 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
2 37 2 All Night 150 1
18 2 19 All Day 2 10
1 14 15 Mno All 20000 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
3 33 2 All Night 150 1
18 2 19 All Day 5 10
1 14 15 Mno All 23674 100
0 0 0 None None 0 0
 2 1 3 Alm All 1 1
3 37 2 All Nifht 150 1
18 2 19 All Eay 2 10
1 14 15 Nnn All 23674 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
2 85 2 All Night 150 1
18 2 19 All Day 5 10
1 14 15 Mon All 20000 100
0 0 0 None None 0 0
 1 1 3 Alm All 1 1
3 33 2 All Night 150 1
18 2 19 All Day 5 10
1 18 15 Mno All 23674 100
0 0 0 None None 0 0

1.0000000000
0.2192439716
0.9884707850
0.0649933899
 1.0000000000
0.2192439716
0.9884707850
0.0551908602
 1.0000000000
0.2192439716
0.9884707850
 1.0000000000
0.1368421872
0.9884707850
0.0649933899
 1.0000000000
0.2794643746
0.9884707850
0.0649933899
 1.0000000000
0.2192439716
0.9999990463
0.0649933899
 1.0000000000
0.1980721269
0.9884707850
0.0551908602
 1.0000000000
0.2192439716
0.9999990463
 1.0000000000
0.4336618793
0.9884707850
0.0649933899
 1.0000000000
0.1980721269
0.9884707850
0.0703926712

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

```c
// AOJ 	2509: Sim Forest 2013
// 2018.1.3 bal4u@uu

#include <stdio.h>
#include <math.h>

char *s_time[3] = {"Day", "Night", "All"};
int id_time[3] = {0,1,2}, len_time[3] = {4,6,4};
int tr_time['Z'];

int tbl[3][2][20160];		// day/night/all, weekday/all, 20160 = 2*7*24*60

char buf[50], *bp;

int in()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	bp++;
	return n;
}

int main()
{
	int s, n, t, weekday, time, p, m, i, j, k, lim, cnt, ans;

	for (i = 0; i < 3; i++) bp = s_time[i], tr_time[*bp] = id_time[i];

	// imos method
	tbl[0][0][ 6*60+1] = 1, tbl[0][0][18*60+1] = -1;		// day    6:00-18:00
	tbl[1][0][18*60+1] = 1, tbl[1][0][24*60+1] = -1;		// night 18:00-24:00
	tbl[1][0][      1] = 1, tbl[1][0][ 6*60+1] = -1;		// night  0:00- 6:00
	tbl[2][0][      1] = 1, tbl[2][0][24*60+1] = -1;		// all    0:00-24:00

	for (i = 0; i < 3; i++) for (j = 0; j <= 24*60+2; j++) tbl[i][0][j+1] += tbl[i][0][j];

	// for all weekday
	for (i = 0; i < 3; i++) for (j = 0; j < 24*60; j++) for (t = 0, k = 0; k < 7; k++, t += 24*60)
		tbl[i][1][j+t] = tbl[i][0][j];
	
	while (1) {
		fgets(bp=buf, 50, stdin);
		s = in(), n = in(), t = in();
		if (*bp == 'N') break;				// None -> exit
		weekday = (*bp == 'A'),  bp += 4;
		time = tr_time[*bp],     bp += len_time[time];
		p = in(), m = in();

		lim = 1444;	if (weekday) lim = 10085;	// 10085 = 7*24*60+5
		ans = 0;
		for (i = 0; i < lim; i++) {
			cnt = 0;
			for (k = i, j = 0; j < m; j++, k += t) {
				if (tbl[time][weekday][k % 10080] && tbl[time][weekday][(k+s) % 10080]) cnt++;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%.10lf\n", 1-pow(1-1.0/p, ans*n));
	}
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s_time
	.section	.rodata
.LC0:
	.string	"Day"
.LC1:
	.string	"Night"
.LC2:
	.string	"All"
	.section	.data.rel.local,"aw"
	.align 16
	.type	s_time, @object
	.size	s_time, 24
s_time:
	.quad	.LC0
	.quad	.LC1
	.quad	.LC2
	.globl	id_time
	.data
	.align 8
	.type	id_time, @object
	.size	id_time, 12
id_time:
	.long	0
	.long	1
	.long	2
	.globl	len_time
	.align 8
	.type	len_time, @object
	.size	len_time, 12
len_time:
	.long	4
	.long	6
	.long	4
	.globl	tr_time
	.bss
	.align 32
	.type	tr_time, @object
	.size	tr_time, 360
tr_time:
	.zero	360
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 483840
tbl:
	.zero	483840
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	bp
	.align 8
	.type	bp, @object
	.size	bp, 8
bp:
	.zero	8
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	bp(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, bp(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	bp(%rip), %rax
	addq	$1, %rax
	movq	%rax, bp(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.section	.rodata
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	$0, -48(%rbp)
	jmp	.L6
.L7:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	s_time(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	id_time(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tr_time(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -48(%rbp)
.L6:
	cmpl	$2, -48(%rbp)
	jle	.L7
	movl	$1, 1444+tbl(%rip)
	movl	$-1, 4324+tbl(%rip)
	movl	$1, 165604+tbl(%rip)
	movl	$-1, 167044+tbl(%rip)
	movl	$1, 161284+tbl(%rip)
	movl	$-1, 162724+tbl(%rip)
	movl	$1, 322564+tbl(%rip)
	movl	$-1, 328324+tbl(%rip)
	movl	$0, -48(%rbp)
	jmp	.L8
.L11:
	movl	$0, -44(%rbp)
	jmp	.L9
.L10:
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	addl	$1, %eax
	addl	%edx, %ecx
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -44(%rbp)
.L9:
	cmpl	$1442, -44(%rbp)
	jle	.L10
	addl	$1, -48(%rbp)
.L8:
	cmpl	$2, -48(%rbp)
	jle	.L11
	movl	$0, -48(%rbp)
	jmp	.L12
.L17:
	movl	$0, -44(%rbp)
	jmp	.L13
.L16:
	movl	$0, -52(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L14
.L15:
	movl	-44(%rbp), %edx
	movl	-52(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rcx
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$40320, %rdx, %rdx
	addq	%rcx, %rdx
	addq	$20160, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
	addl	$1440, -52(%rbp)
.L14:
	cmpl	$6, -40(%rbp)
	jle	.L15
	addl	$1, -44(%rbp)
.L13:
	cmpl	$1439, -44(%rbp)
	jle	.L16
	addl	$1, -48(%rbp)
.L12:
	cmpl	$2, -48(%rbp)
	jle	.L17
.L27:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -20(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -52(%rbp)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$78, %al
	je	.L30
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -16(%rbp)
	movq	bp(%rip), %rax
	addq	$4, %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movq	bp(%rip), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	len_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	movq	%rax, bp(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	$1444, -36(%rbp)
	cmpl	$0, -16(%rbp)
	je	.L20
	movl	$10085, -36(%rbp)
.L20:
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L22
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	addl	$1, -32(%rbp)
.L23:
	addl	$1, -44(%rbp)
	movl	-52(%rbp), %eax
	addl	%eax, -40(%rbp)
.L22:
	movl	-44(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L25
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L25:
	addl	$1, -48(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L26
	movl	-28(%rbp), %eax
	imull	-20(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-8(%rbp), %xmm2
	movsd	.LC3(%rip), %xmm0
	movapd	%xmm0, %xmm1
	divsd	%xmm2, %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movapd	%xmm3, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movsd	.LC3(%rip), %xmm1
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.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	s_time
	.section	.rodata
.LC0:
	.string	"Day"
.LC1:
	.string	"Night"
.LC2:
	.string	"All"
	.section	.data.rel.local,"aw"
	.align 16
	.type	s_time, @object
	.size	s_time, 24
s_time:
	.quad	.LC0
	.quad	.LC1
	.quad	.LC2
	.globl	id_time
	.data
	.align 8
	.type	id_time, @object
	.size	id_time, 12
id_time:
	.long	0
	.long	1
	.long	2
	.globl	len_time
	.align 8
	.type	len_time, @object
	.size	len_time, 12
len_time:
	.long	4
	.long	6
	.long	4
	.globl	tr_time
	.bss
	.align 32
	.type	tr_time, @object
	.size	tr_time, 360
tr_time:
	.zero	360
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 483840
tbl:
	.zero	483840
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	bp
	.align 8
	.type	bp, @object
	.size	bp, 8
bp:
	.zero	8
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	bp(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, bp(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	bp(%rip), %rax
	addq	$1, %rax
	movq	%rax, bp(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.section	.rodata
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	$0, -48(%rbp)
	jmp	.L6
.L7:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	s_time(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	id_time(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tr_time(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -48(%rbp)
.L6:
	cmpl	$2, -48(%rbp)
	jle	.L7
	movl	$1, 1444+tbl(%rip)
	movl	$-1, 4324+tbl(%rip)
	movl	$1, 165604+tbl(%rip)
	movl	$-1, 167044+tbl(%rip)
	movl	$1, 161284+tbl(%rip)
	movl	$-1, 162724+tbl(%rip)
	movl	$1, 322564+tbl(%rip)
	movl	$-1, 328324+tbl(%rip)
	movl	$0, -48(%rbp)
	jmp	.L8
.L11:
	movl	$0, -44(%rbp)
	jmp	.L9
.L10:
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	addl	$1, %eax
	addl	%edx, %ecx
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -44(%rbp)
.L9:
	cmpl	$1442, -44(%rbp)
	jle	.L10
	addl	$1, -48(%rbp)
.L8:
	cmpl	$2, -48(%rbp)
	jle	.L11
	movl	$0, -48(%rbp)
	jmp	.L12
.L17:
	movl	$0, -44(%rbp)
	jmp	.L13
.L16:
	movl	$0, -52(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L14
.L15:
	movl	-44(%rbp), %edx
	movl	-52(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	imulq	$40320, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rcx
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$40320, %rdx, %rdx
	addq	%rcx, %rdx
	addq	$20160, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
	addl	$1440, -52(%rbp)
.L14:
	cmpl	$6, -40(%rbp)
	jle	.L15
	addl	$1, -44(%rbp)
.L13:
	cmpl	$1439, -44(%rbp)
	jle	.L16
	addl	$1, -48(%rbp)
.L12:
	cmpl	$2, -48(%rbp)
	jle	.L17
.L27:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -20(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -52(%rbp)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$78, %al
	je	.L30
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -16(%rbp)
	movq	bp(%rip), %rax
	addq	$4, %rax
	movq	%rax, bp(%rip)
	movq	bp(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movq	bp(%rip), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	len_time(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	movq	%rax, bp(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	$1444, -36(%rbp)
	cmpl	$0, -16(%rbp)
	je	.L20
	movl	$10085, -36(%rbp)
.L20:
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L22
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	imulq	$-804454191, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$13, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10080, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$40320, %rdx, %rdx
	imulq	$20160, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L23
	addl	$1, -32(%rbp)
.L23:
	addl	$1, -44(%rbp)
	movl	-52(%rbp), %eax
	addl	%eax, -40(%rbp)
.L22:
	movl	-44(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L25
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L25:
	addl	$1, -48(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L26
	movl	-28(%rbp), %eax
	imull	-20(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-8(%rbp), %xmm2
	movsd	.LC3(%rip), %xmm0
	movapd	%xmm0, %xmm1
	divsd	%xmm2, %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movapd	%xmm3, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movsd	.LC3(%rip), %xmm1
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.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:
