Easy One
시간 제한3초메모리 제한512 MB
1과 2로 이루어진 수열에서 네 가지 연산만 써서 2가 a개인 수열을 2가 b개인 수열로 정확히 t번 만에 바꾸는 방법의 수를 센다.
문제
You have a sequence of digits and . In one step you can:
- Insert in a place which is to the right of every other (or anywhere if there are no s).
- Transform any into , if there are no s to the right of this .
- Delete the rightmost (note that this operation is inverse to the operation 1).
- Transform the rightmost into (note that this operation is inverse to the operation 2).
For example, you can obtain the following sequences in one step from the sequence 11212122:
- With operation 1: 112121122, 112121212, 112121221.
- With operation 2: 11212112, 11212121.
- With operation 3: 1121222.
- With operation 4: 11212222.
Your task is to calculate the number of ways to transform a sequence of exactly digits to a sequence of exactly digits , using exactly operations.
입력
The only line of the input contains three integers , , and ().
출력
Output the number of ways to obtain a sequence of digits from a sequence of digits in exactly steps. As this number can be very large, output it modulo prime number .
힌트
In the first sample you should obtain an empty sequence from an empty sequence in 4 steps. Ways to do this are ( stands for empty sequence):