In Video Game II: Almost Video Game III, you control a character which has abilities, numbered from to . The objective of this game is to defeat bosses, which are numbered from to , in the order you have to beat them.
At the beginning of a playthrough, none of the abilities has been researched yet. Before facing each boss, you can research a (possibly empty) subset of the abilities. Once an ability is researched, it will stay available for the rest of the playthrough and you do not have to research it again.
After beating all bosses, the score of the playthrough is equal to , where is the number of bosses where your character had all abilities researched.
Let’s consider the following playthrough for and :
- Before fighting boss , you research ability .
- You fight boss with ability researched.
- Before fighting boss , you don’t research any new abilities.
- You fight boss with ability (ability ) researched.
- Before fighting boss , you research abilities and .
- You fight boss with all abilities researched.
- Before fighting boss , you don’t research any new abilities.
- You fight boss with all abilities researched.
Since you fought bosses and with all abilities researched, is equal to and the score of this playthrough is .
Task
What is the sum of the scores of all possible playthroughs? Two playthroughs are considered different if there exists a boss () that you fight having a different subset of abilities researched.
Since the answer can be large, print its remainder modulo , where is a prime number given in the input.
Input data
The first line of input contains three integers , and : the number of bosses, the number of abilities, and the modulo.
Output data
Print one integer, the sum of the scores of all possible playthroughs modulo .
Constraints and clarifications
- and is a prime number.
# | Points | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 9 | |
3 | 5 | |
4 | 8 | |
5 | 7 | |
6 | 15 | |
7 | 29 | |
8 | 18 | |
9 | 9 | No additional constraints |
Example 1
stdin
3 2 100000007
stdout
26
Explanation
In this sample case, there are bosses and abilities.
A playthrough is denoted as a sequence of sets , where:
- is the subset of the abilities researched before facing boss ;
- is the subset of the abilities researched before facing boss ;
- is the subset of the abilities researched before facing boss .
In total, there are different playthroughs:
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
- , with a score of .
The sum of the scores across all possible playthroughs is .
Example 2
stdin
5 3 998244353
stdout
517
Example 3
stdin
999013 97 998244853
stdout
116848898
Example 4
stdin
958613246711292682 1000000 1000000007
stdout
112173097