Consider the sequence a_n defined by the following recurrence:
where is a prime number.
Let
where denotes the factorial of , that is, m! = 1 \times 2 \times \dots \times m.
It may seem strange, but for all and all , the sequence b_n has a limit as n \to +\infty. Your task is to find this limit. Given and , find this value:
The input contains two integers and (2 \le p, m \le 12, and is prime).
Output the limit described above.
Example 1