Gomory and Hu found an array of natural numbers in the basement of their house. While wondering what the meaning of this array might be, they started playing with several subsequences of it, eventually reaching contradictory opinions.
Gomory is firmly convinced that a subsequence which could reveal important information is one in which the absolute difference between the values of any two elements is less than or equal to a number . At the same time, Hu completely disagrees with this statement, considering that a subsequence would be important if the absolute difference between the positions of any two elements is less than or equal to a number .
After a long argument, they ask for your help in finding the number of subsequences that are important to both of them.
Task
Formally, you are given an array of natural numbers, of length . You must compute the number of subsequences of this array in which the absolute difference between the values of any two elements is less than or equal to and the absolute difference between the positions of any two elements is less than or equal to .
Input Data
On the first line, the natural numbers , and are read, with the meaning given in the statement.
On the second line, the natural numbers that form the array are read, separated by spaces.
Output Data
You must output a single natural number representing the number of subsequences of the array in which the absolute difference between any two values is less than or equal to and the absolute difference between the positions of any two elements is less than or equal to , modulo .
Constraints
- A subsequence is obtained from the original array by removing elements at arbitrary positions.
| # | Points | Restrictions |
|---|---|---|
| 1 | 10 | |
| 2 | 10 | |
| 3 | 20 | |
| 4 | 20 | |
| 5 | 40 | No additional constraints |
Example
stdin
5 10 3
20 10 30 40 10
stdout
9
Explanation
In the given example, the good subsequences are: , , , , , , , , .