#Q24. 「一本通 1.3 练习 1」埃及分数

「一本通 1.3 练习 1」埃及分数

Description

Source: BIO 1997 Round 1 Question 3

In ancient Egypt, people used sums of unit fractions (of the form 1a\dfrac{1}{a}, where aa is a natural number) to represent all rational numbers. For example: 23=12+16\dfrac{2}{3} = \dfrac{1}{2} + \dfrac{1}{6}, but 23=13+13\dfrac{2}{3} = \dfrac{1}{3} + \dfrac{1}{3} is not allowed because the addends are identical. For a fraction ab\dfrac{a}{b}, there are many ways to represent it, but which one is the best? First, a representation with fewer addends is better than one with more. Second, among representations with the same number of addends, the one with the largest smallest fraction is preferred. For example:

$$\begin{aligned} \frac{19}{45} &= \frac{1}{3} + \frac{1}{12} + \frac{1}{180}\\ \frac{19}{45} &= \frac{1}{3} + \frac{1}{15} + \frac{1}{45}\\ \frac{19}{45} &= \frac{1}{3} + \frac{1}{18} + \frac{1}{30}\\ \frac{19}{45} &= \frac{1}{4} + \frac{1}{6} + \frac{1}{180}\\ \frac{19}{45} &= \frac{1}{5} + \frac{1}{6} + \frac{1}{18}\\ \end{aligned} $$

The best representation is the last one because 118\dfrac{1}{18} is larger than $\dfrac{1}{180}, \dfrac{1}{45}, \dfrac{1}{30}, \dfrac{1}{18}$.
Note that there may be multiple optimal solutions. For example:

$$\begin{aligned} \frac{59}{211} &= \frac{1}{4} + \frac{1}{36} + \frac{1}{633} + \frac{1}{3798}\\ \frac{59}{211} &= \frac{1}{6} + \frac{1}{9} + \frac{1}{633} + \frac{1}{3798}\\ \end{aligned} $$

Since the smallest fractions in the first and second methods are the same, both are considered optimal solutions.

Given aa and bb, write a program to compute the best representation. It is guaranteed that the optimal solution satisfies: the smallest fraction 1107\ge \cfrac{1}{10^7}.

Input Format

One line containing two integers, the values of aa and bb.

Output Format

Output several numbers, arranged in ascending order, representing the denominators of the unit fractions.

Sample 1

19 45

5 6 18

Constraints and Hints

0<a<b<10000 \lt a \lt b \lt 1000