#Q231. 「一本通 6.6 例 4」古代猪文
「一本通 6.6 例 4」古代猪文
Description
Original source: SDOI 2010
The civilization of the Pig Kingdom is profound and extensive.
iPig was researching in the Fat Pig School Library and discovered that the total number of ancient Pig script characters was . Of course, if a language has many characters, its dictionary would correspondingly be very large. The king of the Pig Kingdom at that time considered that compiling such a dictionary might far exceed the scale of the Kangxi Dictionary, and the labor and resources required would be incalculable. After careful consideration, the king decided not to undertake this laborious and costly project. Naturally, the Pig script was later simplified over time, with some less commonly used characters removed.
iPig intends to study the Pig script of a certain dynasty from ancient times. According to relevant historical records, the Pig script passed down from that dynasty was exactly of the ancient script, where is a positive divisor of (which could be or ). However, exactly which it was, and what was, are lost to history due to the passage of time.
iPig believes that as long as it aligns with the historical records, every possible that divides is plausible. He plans to consider all possible . Clearly, when is fixed, the number of Pig script characters from that dynasty would be . However, there are also numerous ways to preserve characters out of . iPig estimates that if the sum of all possible cases for all possible is , then the cost of his research into the ancient script would be raised to the power of .
Now he wants to know the cost of researching the ancient script for the Pig Kingdom. Since iPig suspects this number might be astronomically large, you only need to provide the remainder when the answer is divided by .
Input Format
The input consists of exactly one line: two numbers and , separated by a space.
Output Format
The output consists of exactly one line: a number representing the remainder when the answer is divided by .
Sample 1
4 2
2048
Data Range and Hints
For of the data, ;
For of the data, ;
For of the data, ;
For of the data, , .