Processing math: 100%
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: x1+x2+...+xn=S that satisfy: L≤xi≤H for all i such that (1≤i≤n) ### Input - Consists of four integers S,n,L,H (0≤L≤H≤S,1≤n≤S≤106) . ### Output - Print the answer modulo 109+7. ### Ví dụ Input: 5302 Output: 3