Restricted equation 2 - MarisaOJ: Marisa Online Judge

Restricted equation 2

Time limit: 1000 ms
Memory limit: 256 MB
Given four positive integers $S,n,L,H$. Count the number of integer solutions of the following equation: $$x_1+x_2+...+x_n=S$$ that satisfy: $$L \le x_i \le H$$ for all $i$ such that $(1 \le i \le n)$ ### Input - Consists of four integers $S,n,L,H$ $(0 \le L \le H \le S,1 \le n \le S \le 10^6)$ . ### Output - Print the answer modulo $10^9+7$. ### Ví dụ Input: ``` 5 3 0 2 ``` Output: ``` 3 ```