Mouse Stofl's uncle Jack was nominated as commander-in-chief of the army of cheese land. Jack wants to know as soon as possible how big his army really is. So far he only figured out that the number of soldiers is in the range from $A$ to $B$.

For determining the exact number, he commands his soldiers to form rows of $x$ soldiers each. Jack then looks at the last row and counts the soldiers in this row (a number between $0$ and $x-1$).

As every soldier has to count to $x$ in order to decide whether he can stand in a certain row as well or not, the formation rows of $x$ soldiers takes time $x$.

If the number of soldiers in cheese land is not clear after the formation, then Jack will call another number $y$ to rearrange the soldiers. They will build rows of $y$ soldiers, which takes time $y$. He repeats this step until he is sure, that he knows the correct number of soldiers under his command.

Help uncle Jack to count his army as quickly as possible.


Give two integers $A$ and $B$, determine the optimal numbers {$x,y,z,…$} that Jack has to call, such that he can unambiguously count the soldiers and that the sum of the chosen numbers is minimal.


The input consists of a single line containing two integers $A$ and $B$, which describe the possible range of the army size.


The output consists of two lines. On the first line print an integer $N$, the amount of chosen numbers.

On the second line print these $N$ numbers, separated by a space character.



1 8

2 5

Of course Jack could just call 8. But with the combination of 2 and 5 each amount between 1 and 8 can be uniquely distinguished from all others and it only takes 2+5=7 units of time instead of 8.


While doing some research for uncle Jack, mouse Stofl found out that a Chinese officer counted his army using some similar method. His method is known in mathematics a the 'Chinese remainder theorem'.

Here you can find a short explanation of this method:

Same as uncle Jack, the Chinese officer calls number in order to group his army into corresponding rows. He only calls relatively prime numbers and writes down the number of soldiers in the last row.


We are trying to figure out the amount of soldiers x as follows:

rows of 3: 1 soldier left in the last row

rows of 4: 3 soldier left in the last row

rows of 5: 2 soldier left in the last row

We can also say that number of soldiers $x$ when dividing by three has a remainder of 1 or that $x$ modulo 3 equals 1. One often writes «$x = 1$ mod $3$» and calls such an equation a congruence.

$3$, $4$ and $5$ are obviously relatively prime. We now name the row sizes $m_1=3, m_2=4, m_3=5$ and the remainders $r_1=1, r_2=3, r_3=2$.

Furthermore we choose $m=$ lcm$(m_1,…,m_n)=\Pi_{i=1}^{n}{m_i}=m_1*m_2*m_3=3*4*5=60$, where lcm denotes the least common multiple.

The Chinese remainder theorem states that in the range from $0$ to $m-1$ each number results in a unique combination of remainders $r_1, …, r_n$.

Now let us take a look at how we can figure out the unique $x$, based on the $m_i$ and $r_i$. For this purpose we calculate $M_i = m/m_i$, so in our example: $M_1=20, M_2=15, M_3=12$.

Next up is the mathematically most challenging part: we determine the multiplicative inverse of $M_i$ modulo $m_i$. This means that we are looking for numbers $y_i$ such that $y_i*M_i = 1$ mod $m_i$.

There is an algorithm called 'extended Euclidean algorithm' that calculates these inverses, which does not need to be explained in more detail here. For our simple example we can simply find the inverses with trial and error:

$y_1 = 2$, as $2*20 = 40$ which is modulo 3 equal to $40 - 13*3 = 1$.

Similarly $y_2 = 3$, as $3*15$ modulo 4 equals $45 - 11*4 = 1$

and $y_3= 3$, as $3*12$ modulo 5 equals $36 - 7*5 = 1$.

Now we have all the ingredients we need for calculating $x$. We get:

$x = \sum_{i=1}^{n}(r_i*y_i*M_i)$ mod $m$.

In our example this means that we can calculate $x$ as follows:

$x=(1*2*20 + 3*3*15 + 2*3*12)$ mod 60 = 247 mod 60 = 7.

In the example the Chinese officer therefore has 7 soldiers under his command.

Summarised this means that after calling a set of relatively prime numbers, we can differentiate all numbers in the range from 0 to (the lowest common multiple of these numbers - 1).

More detailed explanations about the Chinese remainder theorem and the extended Euclidean algorithm can be found here:

Chinese remainder theorem in the English Wikipedia:

Informatikdepartement der FH Flensburg über den chinesischen Restsatz (in German):

Extended Euclidean algorithm in the English Wikipedia: