#abc265f. [abc265_f]Manhattan Cafe
[abc265_f]Manhattan Cafe
Problem Statement
In an -dimensional space, the Manhattan distance between two points and is defined by:
$\\displaystyle d(x,y)=\\sum_{i=1}^n \\vert x_i - y_i \\vert.$
A point is said to be a lattice point if the components are all integers.
You are given lattice points and in an -dimensional space.
How many lattice points satisfy and ? Find the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
1 5
0
3
Sample Output 1
8
When , we consider points in a one-dimensional space, that is, on a number line.
lattice points satisfy the conditions: .
Sample Input 2
3 10
2 6 5
2 1 2
Sample Output 2
632
Sample Input 3
10 100
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
Sample Output 3
145428186