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

```c
#include <stdio.h>

typedef long long int ll;
const int mod = 1000000007;

ll dp[1001];
int fact[1001];
int ifact[1001];

int modpow(int n, int k){
  int r = 1;
  for(;k;k>>=1){
    if(k&1) r = (ll) r * n % mod;
    n = (ll) n * n % mod;
  }
  return r;
}

int main(){
  int i, j, k, n, a, b, c, d;

  fact[0]=1;
  for(i=1;i<=1000;i++) fact[i] = (ll) i * fact[i-1] % mod;
  ifact[1000] = modpow(fact[1000], mod-2);
  for(i=999;i>=0;i--) ifact[i] = (ll) (i+1) * ifact[i+1] % mod;
  
  
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

  for(i=1;i<=n;i++){
    if((i%a==0) && (i/a>=c) && (i/a<=d)){
      dp[i] = (ll) fact[i] * ((ll) modpow(ifact[a], i/a) * ifact[i/a] % mod) % mod;
    }
  }
  dp[0] = 1;

  for(j=a+1;j<=b;j++){
    int f = modpow(ifact[j], c);
    for(i=n;i>=0;i--){
      int tmp = f;
      ll tmp1 = 0;
      for(k=c; k<=d && k*j<=i; k++){
        tmp1 = (tmp1 + dp[i-k*j] * tmp % mod * ifact[i-k*j] % mod * ifact[k]) % mod;
        tmp = (ll) tmp * ifact[j] % mod;
      }
      dp[i] = (dp[i] + tmp1 * fact[i]) % mod;
    }
  }

  printf("%lld\n", dp[n]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mod
	.section	.rodata
	.align 4
	.type	mod, @object
	.size	mod, 4
mod:
	.long	1000000007
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 8008
dp:
	.zero	8008
	.globl	fact
	.align 32
	.type	fact, @object
	.size	fact, 4004
fact:
	.zero	4004
	.globl	ifact
	.align 32
	.type	ifact, @object
	.size	ifact, 4004
ifact:
	.zero	4004
	.text
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L2
.L4:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -4(%rbp)
.L3:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L2:
	cmpl	$0, -24(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%d%d%d%d%d"
.LC1:
	.string	"%lld\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
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, fact(%rip)
	movl	$1, -52(%rbp)
	jmp	.L7
.L8:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	fact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -52(%rbp)
.L7:
	cmpl	$1000, -52(%rbp)
	jle	.L8
	movl	$1000000007, %eax
	leal	-2(%rax), %edx
	movl	4000+fact(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, 4000+ifact(%rip)
	movl	$999, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L9:
	cmpl	$0, -52(%rbp)
	jns	.L10
	leaq	-56(%rbp), %rdi
	leaq	-60(%rbp), %rsi
	leaq	-64(%rbp), %rcx
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -52(%rbp)
	jmp	.L11
.L13:
	movl	-68(%rbp), %ecx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-60(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L12
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rbx
	movl	-68(%rbp), %esi
	movl	-52(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %ecx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	modpow
	movslq	%eax, %rcx
	movl	-68(%rbp), %edi
	movl	-52(%rbp), %eax
	cltd
	idivl	%edi
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	imulq	%rbx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L12:
	addl	$1, -52(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jle	.L13
	movq	$1, dp(%rip)
	movl	-68(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L14
.L20:
	movl	-60(%rbp), %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, -36(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -52(%rbp)
	jmp	.L15
.L19:
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movq	$0, -32(%rbp)
	movl	-60(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L18:
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rax, %rcx
	movq	%rcx, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -32(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -40(%rbp)
	addl	$1, -44(%rbp)
.L16:
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jg	.L17
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L18
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L15:
	cmpl	$0, -52(%rbp)
	jns	.L19
	addl	$1, -48(%rbp)
.L14:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L20
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	modpow
	.type	modpow, @function
modpow:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%esi, %ecx
	movl	$1, %r8d
	testl	%esi, %esi
	je	.L1
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L3
	movslq	%r8d, %r8
	imulq	%rdi, %r8
	movq	%r8, %rax
	imulq	%rsi
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L3:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	imulq	%rsi
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	sarl	%ecx
	jne	.L4
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	modpow, .-modpow
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d%d"
.LC1:
	.string	"%lld\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
	movl	$1, %esi
	movabsq	$-8543223828751151131, %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	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movl	$1, %eax
	movl	$1, fact(%rip)
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	%eax, %rcx
	leaq	fact(%rip), %rbx
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%rdi
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	%ecx, (%rbx,%rsi,4)
	addq	$1, %rsi
	movl	%ecx, %eax
	cmpq	$1001, %rsi
	jne	.L12
	movl	4000+fact(%rip), %ecx
	movl	$30, %r8d
	movl	$1, %esi
	movl	$1000000005, %edi
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%ecx, %rcx
	testb	$1, %dil
	je	.L13
	movslq	%esi, %rsi
	imulq	%rcx, %rsi
	movq	%rsi, %rax
	imulq	%r9
	leaq	(%rdx,%rsi), %rax
	movq	%rsi, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %esi
.L13:
	imulq	%rcx, %rcx
	sarl	%edi
	movq	%rcx, %rax
	imulq	%r9
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %ecx
	subl	$1, %r8d
	jne	.L14
	movl	%esi, 4000+ifact(%rip)
	movl	$1000, %edi
	leaq	-4+ifact(%rip), %rbp
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	%esi, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	imulq	%r8
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	%ecx, 0(%rbp,%rdi,4)
	movl	%ecx, %esi
	subq	$1, %rdi
	jne	.L15
	leaq	.LC0(%rip), %rdi
	leaq	92(%rsp), %rcx
	xorl	%eax, %eax
	leaq	88(%rsp), %rdx
	leaq	84(%rsp), %rsi
	leaq	100(%rsp), %r9
	leaq	96(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	84(%rsp), %eax
	movl	88(%rsp), %edi
	leaq	dp(%rip), %r15
	movl	%eax, 64(%rsp)
	testl	%eax, %eax
	jle	.L22
	leal	1(%rax), %r11d
	movslq	%edi, %rax
	movl	96(%rsp), %r12d
	movl	100(%rsp), %r13d
	movq	%rax, 16(%rsp)
	movl	$1, %esi
	leaq	dp(%rip), %r15
	leaq	ifact(%rip), %r14
	movabsq	$-8543223828751151131, %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%esi, %eax
	cltd
	idivl	%edi
	movslq	%eax, %r10
	testl	%edx, %edx
	jne	.L17
	cmpl	%r12d, %r10d
	jl	.L17
	cmpl	%r13d, %r10d
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rsi
	cmpq	%rsi, %r11
	jne	.L21
.L22:
	movl	92(%rsp), %eax
	addl	$1, %edi
	movq	$1, dp(%rip)
	movl	%eax, 68(%rsp)
	cmpl	%edi, %eax
	jl	.L64
	movl	100(%rsp), %ebx
	movl	96(%rsp), %eax
	leaq	ifact(%rip), %r14
	movabsq	$-8543223828751151131, %r12
	movl	%ebx, 8(%rsp)
	movslq	%edi, %rbx
	movl	%eax, 32(%rsp)
	movq	%rbx, 56(%rsp)
	movl	%eax, %ebx
	addl	$1, %eax
	imull	%edi, %ebx
	movl	%eax, 48(%rsp)
	imull	%eax, %edi
	movslq	64(%rsp), %rax
	movl	%ebx, 36(%rsp)
	movl	%edi, 44(%rsp)
	movq	%rax, 72(%rsp)
	.p2align 4,,10
	.p2align 3
.L36:
	movq	56(%rsp), %rax
	movl	32(%rsp), %edi
	movl	(%r14,%rax,4), %ecx
	testl	%edi, %edi
	je	.L40
	movl	%ecx, %esi
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%esi, %rsi
	testb	$1, %dil
	je	.L25
	movslq	%r8d, %r8
	imulq	%rsi, %r8
	movq	%r8, %rax
	imulq	%r12
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L25:
	imulq	%rsi, %rsi
	movq	%rsi, %rax
	imulq	%r12
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
	sarl	%edi
	jne	.L26
	movl	%r8d, 52(%rsp)
.L24:
	movl	64(%rsp), %eax
	testl	%eax, %eax
	js	.L27
	cmpl	%eax, 36(%rsp)
	jle	.L28
.L29:
	movslq	%eax, %rcx
	.p2align 4,,10
	.p2align 3
.L33:
	movq	(%r15,%rcx,8), %rsi
	movq	%rsi, %rax
	imulq	%r12
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rsi
	movq	%rsi, (%r15,%rcx,8)
	subq	$1, %rcx
	testl	%ecx, %ecx
	jns	.L33
.L27:
	movl	32(%rsp), %edi
	addq	$1, 56(%rsp)
	addl	%edi, 36(%rsp)
	movq	56(%rsp), %rax
	movl	48(%rsp), %edi
	addl	%edi, 44(%rsp)
	cmpl	%eax, 68(%rsp)
	jge	.L36
.L37:
	movq	72(%rsp), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	(%r15,%rax,8), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$120, %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
.L28:
	.cfi_restore_state
	movl	36(%rsp), %ebx
	xorl	%eax, %eax
	movq	72(%rsp), %r11
	movl	56(%rsp), %r13d
	testl	%ebx, %ebx
	cmovns	%ebx, %eax
	movl	%eax, 40(%rsp)
	movslq	%ecx, %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r11d, 28(%rsp)
	movl	8(%rsp), %edi
	movl	%r11d, %ebx
	xorl	%esi, %esi
	cmpl	%edi, 32(%rsp)
	jg	.L30
	movslq	48(%rsp), %r9
	movl	44(%rsp), %r10d
	xorl	%esi, %esi
	movl	52(%rsp), %edi
	movl	36(%rsp), %eax
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L66:
	movl	%r10d, %eax
	addq	$1, %r9
	addl	%r13d, %r10d
	cmpl	%r11d, %eax
	jg	.L30
.L31:
	movl	%ebx, %r8d
	movslq	%edi, %rdi
	subl	%eax, %r8d
	movslq	%r8d, %r8
	movq	(%r15,%r8,8), %rcx
	imulq	%rdi, %rcx
	imulq	16(%rsp), %rdi
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movslq	(%r14,%r8,4), %rax
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movslq	0(%rbp,%r9,4), %rax
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rax, %rcx
	addq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %rsi
	sarq	$29, %rsi
	subq	%rax, %rsi
	imulq	$1000000007, %rsi, %rax
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rdi, %rax
	imulq	%r12
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	cmpl	%r9d, 8(%rsp)
	jge	.L66
.L30:
	leaq	fact(%rip), %rax
	movslq	(%rax,%r11,4), %rcx
	imulq	%rsi, %rcx
	addq	(%r15,%r11,8), %rcx
	movq	%rcx, %rax
	movq	%rcx, %rsi
	imulq	%r12
	sarq	$63, %rsi
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	subq	%rsi, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	28(%rsp), %eax
	movq	%rcx, (%r15,%r11,8)
	subq	$1, %r11
	subl	$1, %eax
	cmpl	%r11d, 40(%rsp)
	jle	.L32
	cmpl	$-1, %eax
	jne	.L29
	jmp	.L27
.L40:
	movl	$1, 52(%rsp)
	jmp	.L24
.L63:
	leaq	fact(%rip), %rax
	movslq	(%rax,%rsi,4), %rax
	movq	%rax, 8(%rsp)
	movq	16(%rsp), %rax
	movl	(%r14,%rax,4), %ecx
	testl	%r10d, %r10d
	je	.L39
	movl	%r10d, %r9d
	movl	$1, %r8d
.L20:
	movslq	%ecx, %rcx
	testb	$1, %r9b
	je	.L19
	movslq	%r8d, %r8
	imulq	%rcx, %r8
	movq	%r8, %rax
	imulq	%rbx
	leaq	(%rdx,%r8), %rax
	movq	%r8, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %r8d
.L19:
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rbx
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %ecx
	sarl	%r9d
	jne	.L20
.L18:
	movslq	(%r14,%r10,4), %rax
	movslq	%r8d, %r8
	movl	$1000000007, %ecx
	imulq	%r8, %rax
	cqto
	idivq	%rcx
	movq	8(%rsp), %rax
	imulq	%rdx, %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r15,%rsi,8)
	jmp	.L17
.L39:
	movl	$1, %r8d
	jmp	.L18
.L64:
	movslq	64(%rsp), %rax
	movq	%rax, 72(%rsp)
	jmp	.L37
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ifact
	.bss
	.align 32
	.type	ifact, @object
	.size	ifact, 4004
ifact:
	.zero	4004
	.globl	fact
	.align 32
	.type	fact, @object
	.size	fact, 4004
fact:
	.zero	4004
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 8008
dp:
	.zero	8008
	.globl	mod
	.section	.rodata
	.align 4
	.type	mod, @object
	.size	mod, 4
mod:
	.long	1000000007
	.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	modpow
	.type	modpow, @function
modpow:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%esi, %ecx
	movl	$1, %r8d
	testl	%esi, %esi
	je	.L1
	movabsq	$-8543223828751151131, %rsi
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	%edi, %rdi
	testb	$1, %cl
	je	.L3
	movslq	%r8d, %r8
	imulq	%rdi, %r8
	movq	%r8, %rax
	imulq	%rsi
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L3:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	imulq	%rsi
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	sarl	%ecx
	jne	.L4
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	modpow, .-modpow
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d%d"
.LC1:
	.string	"%lld\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
	movl	$1, %esi
	movabsq	$-8543223828751151131, %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	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movl	$1, %eax
	movl	$1, fact(%rip)
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	%eax, %rcx
	leaq	fact(%rip), %rbx
	imulq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%rdi
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	%ecx, (%rbx,%rsi,4)
	addq	$1, %rsi
	movl	%ecx, %eax
	cmpq	$1001, %rsi
	jne	.L12
	movl	4000+fact(%rip), %ecx
	movl	$30, %r8d
	movl	$1, %esi
	movl	$1000000005, %edi
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%ecx, %rcx
	testb	$1, %dil
	je	.L13
	movslq	%esi, %rsi
	imulq	%rcx, %rsi
	movq	%rsi, %rax
	imulq	%r9
	leaq	(%rdx,%rsi), %rax
	movq	%rsi, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %esi
.L13:
	imulq	%rcx, %rcx
	sarl	%edi
	movq	%rcx, %rax
	imulq	%r9
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %ecx
	subl	$1, %r8d
	jne	.L14
	movl	%esi, 4000+ifact(%rip)
	movl	$1000, %edi
	leaq	-4+ifact(%rip), %rbp
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	%esi, %rcx
	imulq	%rdi, %rcx
	movq	%rcx, %rax
	imulq	%r8
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	%ecx, 0(%rbp,%rdi,4)
	movl	%ecx, %esi
	subq	$1, %rdi
	jne	.L15
	leaq	.LC0(%rip), %rdi
	leaq	92(%rsp), %rcx
	xorl	%eax, %eax
	leaq	88(%rsp), %rdx
	leaq	84(%rsp), %rsi
	leaq	100(%rsp), %r9
	leaq	96(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	84(%rsp), %eax
	movl	88(%rsp), %edi
	leaq	dp(%rip), %r15
	movl	%eax, 64(%rsp)
	testl	%eax, %eax
	jle	.L22
	leal	1(%rax), %r11d
	movslq	%edi, %rax
	movl	96(%rsp), %r12d
	movl	100(%rsp), %r13d
	movq	%rax, 16(%rsp)
	movl	$1, %esi
	leaq	dp(%rip), %r15
	leaq	ifact(%rip), %r14
	movabsq	$-8543223828751151131, %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%esi, %eax
	cltd
	idivl	%edi
	movslq	%eax, %r10
	testl	%edx, %edx
	jne	.L17
	cmpl	%r12d, %r10d
	jl	.L17
	cmpl	%r13d, %r10d
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rsi
	cmpq	%rsi, %r11
	jne	.L21
.L22:
	movl	92(%rsp), %eax
	addl	$1, %edi
	movq	$1, dp(%rip)
	movl	%eax, 68(%rsp)
	cmpl	%edi, %eax
	jl	.L64
	movl	100(%rsp), %ebx
	movl	96(%rsp), %eax
	leaq	ifact(%rip), %r14
	movabsq	$-8543223828751151131, %r12
	movl	%ebx, 8(%rsp)
	movslq	%edi, %rbx
	movl	%eax, 32(%rsp)
	movq	%rbx, 56(%rsp)
	movl	%eax, %ebx
	addl	$1, %eax
	imull	%edi, %ebx
	movl	%eax, 48(%rsp)
	imull	%eax, %edi
	movslq	64(%rsp), %rax
	movl	%ebx, 36(%rsp)
	movl	%edi, 44(%rsp)
	movq	%rax, 72(%rsp)
	.p2align 4,,10
	.p2align 3
.L36:
	movq	56(%rsp), %rax
	movl	32(%rsp), %edi
	movl	(%r14,%rax,4), %ecx
	testl	%edi, %edi
	je	.L40
	movl	%ecx, %esi
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%esi, %rsi
	testb	$1, %dil
	je	.L25
	movslq	%r8d, %r8
	imulq	%rsi, %r8
	movq	%r8, %rax
	imulq	%r12
	movq	%r8, %rax
	sarq	$63, %rax
	addq	%r8, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r8d
.L25:
	imulq	%rsi, %rsi
	movq	%rsi, %rax
	imulq	%r12
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %esi
	sarl	%edi
	jne	.L26
	movl	%r8d, 52(%rsp)
.L24:
	movl	64(%rsp), %eax
	testl	%eax, %eax
	js	.L27
	cmpl	%eax, 36(%rsp)
	jle	.L28
.L29:
	movslq	%eax, %rcx
	.p2align 4,,10
	.p2align 3
.L33:
	movq	(%r15,%rcx,8), %rsi
	movq	%rsi, %rax
	imulq	%r12
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rsi
	movq	%rsi, (%r15,%rcx,8)
	subq	$1, %rcx
	testl	%ecx, %ecx
	jns	.L33
.L27:
	movl	32(%rsp), %edi
	addq	$1, 56(%rsp)
	addl	%edi, 36(%rsp)
	movq	56(%rsp), %rax
	movl	48(%rsp), %edi
	addl	%edi, 44(%rsp)
	cmpl	%eax, 68(%rsp)
	jge	.L36
.L37:
	movq	72(%rsp), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	(%r15,%rax,8), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$120, %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
.L28:
	.cfi_restore_state
	movl	36(%rsp), %ebx
	xorl	%eax, %eax
	movq	72(%rsp), %r11
	movl	56(%rsp), %r13d
	testl	%ebx, %ebx
	cmovns	%ebx, %eax
	movl	%eax, 40(%rsp)
	movslq	%ecx, %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r11d, 28(%rsp)
	movl	8(%rsp), %edi
	movl	%r11d, %ebx
	xorl	%esi, %esi
	cmpl	%edi, 32(%rsp)
	jg	.L30
	movslq	48(%rsp), %r9
	movl	44(%rsp), %r10d
	xorl	%esi, %esi
	movl	52(%rsp), %edi
	movl	36(%rsp), %eax
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L66:
	movl	%r10d, %eax
	addq	$1, %r9
	addl	%r13d, %r10d
	cmpl	%r11d, %eax
	jg	.L30
.L31:
	movl	%ebx, %r8d
	movslq	%edi, %rdi
	subl	%eax, %r8d
	movslq	%r8d, %r8
	movq	(%r15,%r8,8), %rcx
	imulq	%rdi, %rcx
	imulq	16(%rsp), %rdi
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movslq	(%r14,%r8,4), %rax
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movslq	0(%rbp,%r9,4), %rax
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	imulq	%rax, %rcx
	addq	%rsi, %rcx
	movq	%rcx, %rax
	imulq	%r12
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %rsi
	sarq	$29, %rsi
	subq	%rax, %rsi
	imulq	$1000000007, %rsi, %rax
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rdi, %rax
	imulq	%r12
	movq	%rdi, %rax
	sarq	$63, %rax
	addq	%rdi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %edi
	cmpl	%r9d, 8(%rsp)
	jge	.L66
.L30:
	leaq	fact(%rip), %rax
	movslq	(%rax,%r11,4), %rcx
	imulq	%rsi, %rcx
	addq	(%r15,%r11,8), %rcx
	movq	%rcx, %rax
	movq	%rcx, %rsi
	imulq	%r12
	sarq	$63, %rsi
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	subq	%rsi, %rax
	imulq	$1000000007, %rax, %rax
	subq	%rax, %rcx
	movl	28(%rsp), %eax
	movq	%rcx, (%r15,%r11,8)
	subq	$1, %r11
	subl	$1, %eax
	cmpl	%r11d, 40(%rsp)
	jle	.L32
	cmpl	$-1, %eax
	jne	.L29
	jmp	.L27
.L40:
	movl	$1, 52(%rsp)
	jmp	.L24
.L63:
	leaq	fact(%rip), %rax
	movslq	(%rax,%rsi,4), %rax
	movq	%rax, 8(%rsp)
	movq	16(%rsp), %rax
	movl	(%r14,%rax,4), %ecx
	testl	%r10d, %r10d
	je	.L39
	movl	%r10d, %r9d
	movl	$1, %r8d
.L20:
	movslq	%ecx, %rcx
	testb	$1, %r9b
	je	.L19
	movslq	%r8d, %r8
	imulq	%rcx, %r8
	movq	%r8, %rax
	imulq	%rbx
	leaq	(%rdx,%r8), %rax
	movq	%r8, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %r8d
.L19:
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	imulq	%rbx
	leaq	(%rdx,%rcx), %rax
	movq	%rcx, %rdx
	sarq	$29, %rax
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rax
	subl	%eax, %ecx
	sarl	%r9d
	jne	.L20
.L18:
	movslq	(%r14,%r10,4), %rax
	movslq	%r8d, %r8
	movl	$1000000007, %ecx
	imulq	%r8, %rax
	cqto
	idivq	%rcx
	movq	8(%rsp), %rax
	imulq	%rdx, %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r15,%rsi,8)
	jmp	.L17
.L39:
	movl	$1, %r8d
	jmp	.L18
.L64:
	movslq	64(%rsp), %rax
	movq	%rax, 72(%rsp)
	jmp	.L37
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ifact
	.bss
	.align 32
	.type	ifact, @object
	.size	ifact, 4004
ifact:
	.zero	4004
	.globl	fact
	.align 32
	.type	fact, @object
	.size	fact, 4004
fact:
	.zero	4004
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 8008
dp:
	.zero	8008
	.globl	mod
	.section	.rodata
	.align 4
	.type	mod, @object
	.size	mod, 4
mod:
	.long	1000000007
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>

typedef long long int ll;
const int mod = 1000000007;

ll dp[1001];
int fact[1001];
int ifact[1001];

int modpow(int n, int k){
  int r = 1;
  for(;k;k>>=1){
    if(k&1) r = (ll) r * n % mod;
    n = (ll) n * n % mod;
  }
  return r;
}

int main(){
  int i, j, k, n, a, b, c, d;

  fact[0]=1;
  for(i=1;i<=1000;i++) fact[i] = (ll) i * fact[i-1] % mod;
  ifact[1000] = modpow(fact[1000], mod-2);
  for(i=999;i>=0;i--) ifact[i] = (ll) (i+1) * ifact[i+1] % mod;
  
  
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

  for(i=1;i<=n;i++){
    if((i%a==0) && (i/a>=c) && (i/a<=d)){
      dp[i] = (ll) fact[i] * ((ll) modpow(ifact[a], i/a) * ifact[i/a] % mod) % mod;
    }
  }
  dp[0] = 1;

  for(j=a+1;j<=b;j++){
    int f = modpow(ifact[j], c);
    for(i=n;i>=0;i--){
      int tmp = f;
      ll tmp1 = 0;
      for(k=c; k<=d && k*j<=i; k++){
        tmp1 = (tmp1 + dp[i-k*j] * tmp % mod * ifact[i-k*j] % mod * ifact[k]) % mod;
        tmp = (ll) tmp * ifact[j] % mod;
      }
      dp[i] = (dp[i] + tmp1 * fact[i]) % mod;
    }
  }

  printf("%lld\n", dp[n]);
  return 0;
}

7 3 4 2 5
 8 2 3 1 3
 1000 1 1000 2 1000
 1000 1 1000 3 1000
 10 3 7 2 5
 7 1 3 1 3
 1000 1 1000 1 1001
 7 1 6 2 5
 0 3 8 2 7
 2 1 3 1 2

0
 280
 860178665
 980205027
 126
 595
 465231251
 105
 1
 2

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

```c
#include <stdio.h>

typedef long long int ll;
const int mod = 1000000007;

ll dp[1001];
int fact[1001];
int ifact[1001];

int modpow(int n, int k){
  int r = 1;
  for(;k;k>>=1){
    if(k&1) r = (ll) r * n % mod;
    n = (ll) n * n % mod;
  }
  return r;
}

int main(){
  int i, j, k, n, a, b, c, d;

  fact[0]=1;
  for(i=1;i<=1000;i++) fact[i] = (ll) i * fact[i-1] % mod;
  ifact[1000] = modpow(fact[1000], mod-2);
  for(i=999;i>=0;i--) ifact[i] = (ll) (i+1) * ifact[i+1] % mod;
  
  
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

  for(i=1;i<=n;i++){
    if((i%a==0) && (i/a>=c) && (i/a<=d)){
      dp[i] = (ll) fact[i] * ((ll) modpow(ifact[a], i/a) * ifact[i/a] % mod) % mod;
    }
  }
  dp[0] = 1;

  for(j=a+1;j<=b;j++){
    int f = modpow(ifact[j], c);
    for(i=n;i>=0;i--){
      int tmp = f;
      ll tmp1 = 0;
      for(k=c; k<=d && k*j<=i; k++){
        tmp1 = (tmp1 + dp[i-k*j] * tmp % mod * ifact[i-k*j] % mod * ifact[k]) % mod;
        tmp = (ll) tmp * ifact[j] % mod;
      }
      dp[i] = (dp[i] + tmp1 * fact[i]) % mod;
    }
  }

  printf("%lld\n", dp[n]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mod
	.section	.rodata
	.align 4
	.type	mod, @object
	.size	mod, 4
mod:
	.long	1000000007
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 8008
dp:
	.zero	8008
	.globl	fact
	.align 32
	.type	fact, @object
	.size	fact, 4004
fact:
	.zero	4004
	.globl	ifact
	.align 32
	.type	ifact, @object
	.size	ifact, 4004
ifact:
	.zero	4004
	.text
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L2
.L4:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -4(%rbp)
.L3:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L2:
	cmpl	$0, -24(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%d%d%d%d%d"
.LC1:
	.string	"%lld\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
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, fact(%rip)
	movl	$1, -52(%rbp)
	jmp	.L7
.L8:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	fact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -52(%rbp)
.L7:
	cmpl	$1000, -52(%rbp)
	jle	.L8
	movl	$1000000007, %eax
	leal	-2(%rax), %edx
	movl	4000+fact(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, 4000+ifact(%rip)
	movl	$999, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L9:
	cmpl	$0, -52(%rbp)
	jns	.L10
	leaq	-56(%rbp), %rdi
	leaq	-60(%rbp), %rsi
	leaq	-64(%rbp), %rcx
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -52(%rbp)
	jmp	.L11
.L13:
	movl	-68(%rbp), %ecx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-60(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L12
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rbx
	movl	-68(%rbp), %esi
	movl	-52(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %ecx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	modpow
	movslq	%eax, %rcx
	movl	-68(%rbp), %edi
	movl	-52(%rbp), %eax
	cltd
	idivl	%edi
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	imulq	%rbx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L12:
	addl	$1, -52(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jle	.L13
	movq	$1, dp(%rip)
	movl	-68(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L14
.L20:
	movl	-60(%rbp), %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, -36(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -52(%rbp)
	jmp	.L15
.L19:
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movq	$0, -32(%rbp)
	movl	-60(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L18:
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rax, %rcx
	movq	%rcx, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -32(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -40(%rbp)
	addl	$1, -44(%rbp)
.L16:
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jg	.L17
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L18
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L15:
	cmpl	$0, -52(%rbp)
	jns	.L19
	addl	$1, -48(%rbp)
.L14:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L20
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	mod
	.section	.rodata
	.align 4
	.type	mod, @object
	.size	mod, 4
mod:
	.long	1000000007
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 8008
dp:
	.zero	8008
	.globl	fact
	.align 32
	.type	fact, @object
	.size	fact, 4004
fact:
	.zero	4004
	.globl	ifact
	.align 32
	.type	ifact, @object
	.size	ifact, 4004
ifact:
	.zero	4004
	.text
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L2
.L4:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -4(%rbp)
.L3:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -20(%rbp)
	sarl	-24(%rbp)
.L2:
	cmpl	$0, -24(%rbp)
	jne	.L4
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%d%d%d%d%d"
.LC1:
	.string	"%lld\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
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, fact(%rip)
	movl	$1, -52(%rbp)
	jmp	.L7
.L8:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	fact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -52(%rbp)
.L7:
	cmpl	$1000, -52(%rbp)
	jle	.L8
	movl	$1000000007, %eax
	leal	-2(%rax), %edx
	movl	4000+fact(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, 4000+ifact(%rip)
	movl	$999, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, %ecx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L9:
	cmpl	$0, -52(%rbp)
	jns	.L10
	leaq	-56(%rbp), %rdi
	leaq	-60(%rbp), %rsi
	leaq	-64(%rbp), %rcx
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -52(%rbp)
	jmp	.L11
.L13:
	movl	-68(%rbp), %ecx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-60(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-68(%rbp), %ebx
	movl	-52(%rbp), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L12
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rbx
	movl	-68(%rbp), %esi
	movl	-52(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %ecx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	modpow
	movslq	%eax, %rcx
	movl	-68(%rbp), %edi
	movl	-52(%rbp), %eax
	cltd
	idivl	%edi
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	imulq	%rbx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L12:
	addl	$1, -52(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jle	.L13
	movq	$1, dp(%rip)
	movl	-68(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L14
.L20:
	movl	-60(%rbp), %edx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	modpow
	movl	%eax, -36(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -52(%rbp)
	jmp	.L15
.L19:
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movq	$0, -32(%rbp)
	movl	-60(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L18:
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	movl	%eax, %edx
	movl	-52(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ifact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rax, %rcx
	movq	%rcx, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -32(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ifact(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	imulq	%rdx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -40(%rbp)
	addl	$1, -44(%rbp)
.L16:
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jg	.L17
	movl	-44(%rbp), %eax
	imull	-48(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L18
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	fact(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	$1000000007, %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -52(%rbp)
.L15:
	cmpl	$0, -52(%rbp)
	jns	.L19
	addl	$1, -48(%rbp)
.L14:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L20
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
