Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

A0218 - Almost Origami

You have a rectangular sheet of paper of height 1 and you want to locate any point at height measured from the bottom border of the sheet. Since you do not know Haga’s theorems, you plan to repeat the following step. Assume you already located a point PL at height on the left border of the sheet, and a point PR at height on the right border of the sheet. Then you draw a line from the lower left corner of the sheet to PR, and another line from the lower right corner of the sheet to PL. If the crossing point is at height H, then you are done. Otherwise you draw a horizontal line that passes through the crossing point and go for another step. As an example, consider the case = 1/3. During the first step, the only possibility is choosing the upper corners of the sheet (that is, = 1). So you draw the two diagonals of the sheet, and the crossing point is at height 1/2. Since 6= 1/2, you draw a horizontal line that passes through the crossing point. This line provides two new points with known height 1/2 on the borders of the sheet, one on the left border and the other one on the right border. For the second step you can choose between using the original known points at height 1, or the points you have just located at height 1/2. That is, you can choose either = 1 or = 1/2 and of course = 1 or = 1/2. It is easy to see that if you choose = 1/2, then the crossing point would be at height 1/4. However, if you choose = 1/2 and = 1, then the crossing point would be at the desired height = 1/3. By symmetry, the same occurs if you choose = 1 and = 1/2. Given a rational height H, you must determine a shortest sequence of heights on the borders of the sheet that allows locating a point at height H. As the above example shows, only a point at height 1/2 can be located in a single step, and so a possible shortest sequence for = 1/3 is = (1, 1, 1/2, 1). The first two heights must be chosen during the first step, and the remaining two heights must be chosen during the second step.

Input

The input consists of a single line that contains two integers and (1 ≤ ≤ 100) such that M/is an irreducible fraction

Output

Output a single line with the character “*” (asterisk) if a point at height cannot be located by means of the described procedure. Otherwise, output a shortest sequence of heights S1S2, . . . , SK that allows locating a point at height H, if they are chosen in the order they appear in the sequence. Height Si must be written in the i-th line using two integers Ai and Bi such that SiAi/Bi is an irreducible fraction (= 1, 2, . . . , K). It is guaranteed that when a point at height H can be located, it can be optimally located choosing only rational heights.

Example

Input:
1 3

Output:
1 1
1 1
1 2
1 1
Input:
1 3

Output:
1 1
1 1
1 1
1 2
Input:
3 4

Output:
*

Adicionado por:IFTM_Maratona
Data:2022-12-04
Tempo limite:1s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:C NCSHARP C++ 4.3.2 JAVA JULIA PYTHON3
Origem:Maratona SBC Final Brasileira 2018

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.