where artificial intelligence (1≤ai≤n) is the PC behind which the I-th member needs to sit. Additionally, we have another cluster b of length m comprising of characters 'L' and 'R'. bi is the side from which the I-th member goes into the room. 'L' signifies the member enters from the left of PC 1 and goes from left to right, and
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
We have an exhibit an of length m where
Additionally, we have another cluster b of length m comprising of characters 'L' and 'R'. bi is the side from which the I-th member goes into the room. 'L' signifies the member enters from the left of PC 1 and goes from left to right, and 'R' signifies the member enters from the right of PC n and goes from right to left.
The members in the request from 1 to m go into the room individually. The I-th of them goes into the challenge room toward the path bi and heads to sit behind the simulated intelligence th PC. In case it is involved he continues to stroll toward him until he arrives at the main empty PC. From that point forward, he sits behind it. In the event that he doesn't observe any PC he gets upset and abandons the challenge.
The frenzy of the I-th member is the distance between his doled out PC (simulated intelligence) and the PC he winds up sitting behind. The distance between PCs I and j is equivalent to |i−j|.
The qualities in the exhibit a can be equivalent. There exist nm⋅2m potential sets of exhibits (a,b).
Think about all sets of exhibits (a,b) with the end goal that no individual becomes vexed. For every one of them we should compute the amount of members madnesses. Track down the amount of this multitude of qualities.
You will be given some prime modulo p. Track down this aggregate by modulo p.
Input
The main line contains three integers n, m, p (1≤m≤n≤500,108≤p≤109+9).
It is ensured, that the number p is prime.
Output
Print just a single integer — the necessary aggregate by modulo p.
Step by step
Solved in 4 steps with 1 images