Problem B. Repeating digit (medium)

Author:T. Chistyakov, A. Klenin   Time limit:5 sec
Input file:input.txt   Memory limit:1 Mb
Output file:output.txt  

Statement

For given integers P and N you need to find all such values of x < 10N, that N last digits of xP are non-zero and equal.

Fortunately, there is not so many numbers with this property. For example, for P = 2 and N = 2 there exist only 4 of them:

12, 38, 62, 88

Input file format

Input file contains P and N.

Output file format

Output the number of existing numbers X, then all these numbers in any order.

Constraints

2 &le; P &le; 100

2 &le; N &le; 17

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
3 2
8 
14 42 53 64 77 71 92 99

0.110s 0.015s 13