Ratioland is a beautiful and highly rational country where the official currency is the Ration and the currency symbol is R. Coins are available in denominations of 1 R, for each natural number q q = 1, 2, 3, 4, . . . . Some years ago, the Royal Bank of Ratioland promoted a law to define the properties of all coins: each coin of denomination 1 R had to be a cylinder made of gold with a thickness of 0.1 inches, radius of Number 1q. q 1 inches, and labeled with the fraction representing the magnificent Rational 2·q2 Coins of denomination 1 R, for values of q = 1, 2, 3, 4. q In order to celebrate the beauty of its currency, the Royal Bank of Ratioland wants to display some coins in its museum. For this purpose, it has designed a frame with a width of 2 inches, a height of 1 inch, and a thickness of 0.1 inches. In this frame, two coins of denomination 1 R fit exactly. 1 Moreover, many other coins can be placed in the frame. Raphaello, a renowned and rational artist born in Ratioland, was invited by the bank manager to design the layout to place the coins in the frame. After a week of hard work, Raphaello invented a rational procedure to place the coins inside the frame without any overlapping: ()()() • Embed the frame in a Cartesian coordinate system, locating its corners at −1,0 , 3,0 , 3,1 , () 222 −1,1 . 2 • Since it is possible to place only two coins of denomination 1 R, these coins are to be placed with ()() 1 their centers at 0, 12 and 1, 21 , respectively. •Foreachnaturalnumberq>1,andeachnaturalvaluepsuchthat0<pq <1andpq isan irreducible fraction, a coin of denomination 1 R is to be placed with center at p, 1 . q q 2·q2 ()
2/2 All coins are placed tangent to the horizontal axis of the Cartesian coordinate system. In order avoid confusion, Raphaello decided to name the coin of denomination 1 R with center at p, 1 as q q 2·q2 M(p/q). For example: • M(0/1) is the coin of denomination • M(1/1) is the coin of denomination • M(1/2) is the coin of denomination () 1 R with center at 0, 1 ; 12 () 1 R with center at 1, 1 ; and 12 () 1 R with center at 1, 1 . 228 Raphaello wants to know the first n coins that touch the coin M(p/q) inside the frame when sorting all these coins by decreasing order of radius (i.e., by increasing order of q). If two coins share the same radius, he wants them sorted by increasing order of x coordinates (i.e., by increasing order of p). Input The input consists of several test cases. Each test case is described by a line containing three blank- separated integers p, q, and n (0 ≤ p ≤ 1, 1 ≤ q ≤ 106, 1 ≤ n ≤ 103), with p an irreducible fraction. Output For each test case, print a single line with the n blank-separated names of the first n coins that touch M(p/q) in the frame. The list of coins must be printed in the order previously described. Sample Input 254 233 012 112 125 Sample Output M(1/2) M(1/3) M(3/7) M(3/8) M(1/1) M(1/2) M(3/4) M(1/1) M(1/2) M(0/1) M(1/2) M(0/1) M(1/1) M(1/3) M(2/3) M(2/5) qq ()