{"raw_statement":[{"iden":"problem statement","content":"There are $N$ people, conveniently numbered $1$ through $N$. We want to divide them into some number of groups, under the following two conditions:\n\n*   Every group contains between $A$ and $B$ people, inclusive.\n    \n*   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.\n    \n\nFind 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$."},{"iden":"constraints","content":"*   $1≤N≤10^3$\n*   $1≤A≤B≤N$\n*   $1≤C≤D≤N$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $A$ $B$ $C$ $D$"},{"iden":"sample input 1","content":"3 1 3 1 2"},{"iden":"sample output 1","content":"4\n\nThere are four ways to divide the people:\n\n*   $(1,2),(3)$\n*   $(1,3),(2)$\n*   $(2,3),(1)$\n*   $(1,2,3)$\n\nThe 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."},{"iden":"sample input 2","content":"7 2 3 1 3"},{"iden":"sample output 2","content":"105\n\nThe only ways to divide the people under the conditions are the ones where there are two groups of two people, and one group of three people. There are $105$ such ways."},{"iden":"sample input 3","content":"1000 1 1000 1 1000"},{"iden":"sample output 3","content":"465231251"},{"iden":"sample input 4","content":"10 3 4 2 5"},{"iden":"sample output 4","content":"0\n\nThe answer can be $0$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}