#Lutece3329. Circuit
Circuit
Description
Cai1000 has resistors with a resistance of , and he wants to connect the resistors as follows:
- Choose a resistor as the original circuit.
- Perform the following operations times: Connect a resistor with a resistance of in series or parallel to the previous circuit.
Cai1000 wants to know the -th largest resistance value of the final circuit among all ways of connection (Two ways are considered different if and only if their resistance values are different). Cai1000 is very lazy, so he turned to you for help.
Two resistors with resistances and connected in series equal to a resistor with a resistance of .
Two resistors with resistances and connected in parallel equal to a resistor with a resistance of .
Input
One line with two integers and .
Output
Print the -th largest resistance value which is expressed in the form of an irreducible fraction , i.e. and are integers which meet and .
Samples
Note
In the first example, there are ways of connection:
Their resistance values are respectively. So the third largest resistance value is .
Resources
电子科技大学第十四届 ACM 趣味程序设计竞赛