atcoder#ABC265F. [ABC265F] Manhattan Cafe
[ABC265F] Manhattan Cafe
Score : points
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.
1 5
0
3
8
When , we consider points in a one-dimensional space, that is, on a number line. lattice points satisfy the conditions: .
3 10
2 6 5
2 1 2
632
10 100
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
145428186