Continued fraction
A continued fraction is an expression of the form:
In this expression, a0 is an integer, and the other a_n are positive integers. Continued fractions are fascinating because they can represent any real number. For rational numbers, the fraction will be finite, while for irrational numbers, it will be infinite.
For example, the number 9/4 can be represented as a continued fraction: 9/4 = 2 + 1/(3+1/1).
Alternatively, this fraction can also be expressed as: 9/4 = 2 + 1/4.
Your task is to find the minimal representation of a given rational number p/q as a continued fraction.
Input
The first line of the input contains two integers: p and q (1 <= p, q <= 10^3).
Output
On the first line of the output, print the number n, which is the count of elements in the continued fraction that equals p/q. On the second line, print the numbers a_0, a_1, ..., a_n separated by spaces.