| 2016-2017 CT S03E07: Codeforces Trainings Season 3 Episode 7 - HackerEarth Problems Compilation |
|---|
| Закончено |
You are given four integers n, a, b and x. Your task is to count modulo 109 + 7 the number of sequences of integers A satisfying the following conditions:
The only line of the input contains four integers n, a, b and x (1 ≤ n ≤ 100, 1 ≤ a, b, x ≤ 109, a ≤ b).
Count sequences of integers satisfying the given conditions. Print the answer modulo 109 + 7.
2 1 7 6
9
1 1 50 7
7
In the first sample there are 9 valid sequences: (1, 6), (2, 3), (2, 6), (3, 4), (3, 6), (4, 6), (5, 6), (6, 6), (6, 7).
| Название |
|---|


