An -CIRCULAR NUMBER is a number whose last two digits are
and
, and multiplication of the number by the single digit
is equivalent
to moving the last two digits (
) to the beginning of the number. For
example, the number
is a
-CIRCULAR NUMBER
because
. Write a program
that asks for a two-digit number
and a single digit
, and prints the
smallest
-CIRCULAR NUMBER or prints a message
NONE
if none
exists. It is guaranteed that your number will not exceed digits.
Input Specification
An integer number, , indicating the total number of cases. On each of
the next
lines are the two-digit number
and the single digit
,
separated by a space.
Output Specification
The smallest circular number (if one exists with less than digits)
that satisfies the given condition; otherwise output the message
NONE
.
Sample Input
1
53 4
Sample Output
132832080200501253
Comments