Peter is standing at the origin of the Cartesian plane, and he decided to take a regular walk to point for some positive integers and .
In each step of a regular walk, Peter must move parallel to one of the axes. During a move, he can go either one unit to the right or one unit up.
Formally, a regular walk from to is a sequence of points such that:
- and , and
- for each , either or .
We define the area under a regular walk as the area of the polygon whose vertices in clockwise order are and .
Given a prime number and a remainder , you have to find the number of regular walks from to under which the area is congruent to modulo . Since the answer can be very large, you have to compute it modulo .
Input data
The input file consists of a single line containing integers , , , .
Output data
The output file must contain a single line consisting of integer .
Constraints and clarifications
- .
- .
- .
- is a prime number.
- For tests worth points, .
- For tests worth more points, .
- For tests worth more points, .
Example 1
stdin
2 2 3 1
stdout
2
Explanation
In the first sample case, there are six possible regular walks from to , as shown in the figure below.
The area under the second and the sixth paths are and respectively, both of which give a remainder of when divided by .
Example 2
stdin
2 7 5 3
stdout
7