Given a positive integer N, you’re to solve the following problem:
Find a positive multiple of N, says M, that contains minimal number of different digits in base-K notation. If there’re several solutions, you should output the numerical smallest one. By saying numerical smallest one, we compar their numerical value, so 0xAhex < 11dec.
You may assume that 1 <= N <= 104 and 2 <= K <= 10.