atcoder#ABC265E. [ABC265E] Warp
[ABC265E] Warp
Score : points
Problem Statement
Takahashi is at the origin of a two-dimensional plane. Takahashi will repeat teleporting times. In each teleportation, he makes one of the following moves:
- Move from the current coordinates to
- Move from the current coordinates to
- Move from the current coordinates to
There are obstacles on points on the plane; he cannot teleport to these coordinates.
How many paths are there resulting from the teleportations? Find the count modulo .
Constraints
- , , and are distinct.
- are distinct.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2 2
1 1 1 2 1 3
1 2
2 2
5
The following paths are possible:
10 3
-1000000000 -1000000000 1000000000 1000000000 -1000000000 1000000000
-1000000000 -1000000000
1000000000 1000000000
-1000000000 1000000000
0
300 0
0 0 1 0 0 1
292172978