There are n people, numbered 1 through n .
We want to divide them into a number of groups, under the following two conditions:
- Every group contains between a and b people, inclusive of both a and b.
- Let Fi be the number of the groups containing exactly i people. Then, for all i , either Fi=0 or c <= Fi <= d holds.
Find the number of ways to divide the people into groups. Now two ways to divide them into groups is considered different if there exists two people such that they belong to the same group in exactly one of the 2 ways. Print the answer in 109+7 modulo.
- 1 <= n <= 103
- 1 <= a <= b <= n
- 1 <= c <= d <= n
The line containing 5 integers n, a, b, c, and d.
Print the number of ways to divide the people into groups in 109+7 modulo.