Kuangyeye's Resistance
题号:NC25446
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

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.
示例1

输入

复制
1 1 2

输出

复制
1
示例2

输入

复制
2 2 5

输出

复制
4

备注:

n<=100000,P,R<=2000000000
hint:the equivalent resistance of series circuit  is ,and the equivalent resistance of the parallel circuit is