There are N people, conveniently numbered 1 through N.
We want to divide them into some number of groups, under the following two conditions:
 - Every group contains between A and B people, inclusive.
 - Let F_i be the number of the groups containing exactly i people. Then, for all i, either F_i=0 or C≤F_i≤D holds.
Find the number of these ways to divide the people into groups.
Here, two ways to divide them into groups is considered different if and only if there exists two people such that they belong to the same group in exactly one of the two ways.
Since the number of these ways can be extremely large, print the count modulo 10^9+7.

-----Constraints-----
 - 1≤N≤10^3
 - 1≤A≤B≤N
 - 1≤C≤D≤N

-----Input-----
The input is given from Standard Input in the following format:
N A B C D

-----Output-----
Print the number of ways to divide the people into groups under the conditions, modulo 10^9+7.

-----Sample Input-----
3 1 3 1 2

-----Sample Output-----
4

There are four ways to divide the people:
 - (1,2),(3)
 - (1,3),(2)
 - (2,3),(1)
 - (1,2,3)
The following way to divide the people does not count: (1),(2),(3). This is because it only satisfies the first condition and not the second.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'SIZE=5*10**3; MOD=10**9+7 #998244353 #ここを変更する\n\nSIZE += 1\ninv = [0]*SIZE  # inv[j] = j^{-1} mod MOD\nfac = [0]*SIZE  # fac[j] = j! mod MOD\nfinv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\nfor i in range(2,SIZE):\n    fac[i] = fac[i-1]*i%MOD\nfinv[-1] = pow(fac[-1],MOD-2,MOD)\nfor i in range(SIZE-1,0,-1):\n    finv[i-1] = finv[i]*i%MOD\n    inv[i] = finv[i]*fac[i-1]%MOD\n\ndef choose(n,r): # nCk mod MOD の計算\n    if 0 <= r <= n:\n        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD\n    else:\n        return 0\n\ndef chofuku(ball,box): # nHk mod MOD の計算\n    return choose(box+ball-1,box)\n\n# coding: utf-8\n# Your code here!\nimport sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\n\nn,a,b,c,d = list(map(int,read().split()))\n\n\n\ndp = [0]*(n+1) # i まで見て、x人グループが決まっている\ndp[0] = 1\n\n\n#for i in range(b,a-1,-1):\nfor i in range(a,b+1):\n    invmod = [1]\n    for p in range(1001//i+2): invmod.append(invmod[-1]*finv[i]%MOD)\n    coeff = [fac[i*p]*invmod[p]%MOD*finv[p]%MOD for p in range(1001//i+2)]    \n    \n    ndp = dp[:]\n    for j in range(n+1):\n        for p in range(c,d+1):\n            if j+i*p > n: break\n            ndp[j+i*p] += coeff[p]*dp[j]%MOD*choose(n-j,i*p)\n            ndp[j+i*p] %= MOD\n\n    #print(invmod,i)\n    #print(coeff)\n    dp = ndp\n    #if i < 100:break\n    #print(dp,i)    \nprint((dp[n]%MOD))    \n    \n\n\n\n\n\n\n    \n    \n    \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 656070