Given a positive integer n, write a program that finds the multiple m of n whose decimal representation is made up of the fewest distinct digits. For example, 1334 is made up of the distinct digits 1,3,4 (three of them).
The input consists of several test cases. Each test case is a single line containing the integer n. There are at most 50 test cases, and n is a natural number not greater than 65536. The last line of the input contains a single 0, which marks the end of the input.
For each test case, print the value m defined above, one per line. If more than one such m exists, print the smallest one.