Kuangyeye is a dalao of the ACM team of Hunan University. As a student majoring in communication engineering, he must learn how to analyze various circuits. One day, when he was in class, the teacher was explaining a circuit,but he was too tired to listen to his teacher and fell asleep. When he woke up, he found the teacher had drawn some resistors on the blackboard as shown in the picture below. And the homework is to calculate the equivalent resistance of the n-level network. The resistance of each resistor in the figure is R. Kuangyeye has no idea about that.
Please help pathetic Kuangyeye to solve this problem. If the answer is

, you can just output

module P, where P is a prime.
输入描述:
The input only one test cases, which consists of three integers representing n, R, and P.
输出描述:
Output the resistance value described above.
备注:
n<=100000,P,R<=2000000000
hint:the equivalent resistance of series circuit is

,and the equivalent resistance of the parallel circuit is
