SP370 ONEZERO - Ones and zeros

Description

Certain positive integers have their decimal representation consisting only of ones and zeros, and having at least one digit one, e.g. 101. If a positive integer does not have such a property, one can try to multiply it by some positive integer to find out whether the product has this property.

Input Format

Number _K_ of test cases (_K_ is approximately 1000); in each of the next _K_ lines there is one integer _n_ (_1

Output Format

For each test case, your program should compute the smallest multiple of the number _n_ consisting only of digits 1 and 0 (beginning with 1).