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 = 'MOD = 10 ** 9 + 7\n\ndef power(x, n, MOD):\n    ans = 1\n    while n:\n        if n % 2 == 1:\n            ans = (ans * x) % MOD\n        x = (x * x) % MOD\n        n //= 2\n    return ans\n\ndef getFacts(n, MOD):\n    facts = [1] + [0] * n\n    for x in range(1, n + 1):\n        facts[x] = (facts[x - 1] * x) % MOD\n    return facts\n\ndef getInvFacts(n, factN, MOD):\n    invFacts = [0] * (n + 1)\n    invFacts[n] = power(factN, MOD - 2, MOD)\n    for x in reversed(list(range(n))):\n        invFacts[x] = (invFacts[x + 1] * (x + 1)) % MOD\n    return invFacts\n\ndef getInvss(B, D, facts, MOD):\n    invss = [[0] * (D + 1) for _ in range(B + 1)]\n    invss[B][D] = power(power(facts[B], D, MOD), MOD - 2, MOD)\n    for i in reversed(list(range(B))):\n        invss[i][D] = (invss[i + 1][D] * power(i + 1, D, MOD)) % MOD\n    for i in range(B + 1):\n        for k in reversed(list(range(D))):\n            invss[i][k] = (invss[i][k + 1] * facts[i]) % MOD\n    return invss\n\n\nN, A, B, C, D = list(map(int, input().split()))\n\nfacts = getFacts(N, MOD)\ninvFacts = getInvFacts(N, facts[N], MOD)\ninvss = getInvss(B, D, facts, MOD)\n\n# dp[i][j]: i人以下のグループのみで、j人使っている場合の数\ndp = [[0] * (N + 1) for _ in range(B + 1)]\ndp[A - 1][0] = 1\n\nfor i in range(A, B + 1):\n    for j in range(N + 1):\n        dp[i][j] = dp[i - 1][j]\n        for k in range(C, min(D, j // i) + 1):\n            dp[i][j] += facts[N - j + i * k] * invFacts[N - j] * invss[i][k] * invFacts[k] * dp[i - 1][j - i * k]\n            dp[i][j] %= MOD\n\nprint((dp[B][N]))\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14139