# Special Number

A puzzle from the 1962 International Mathematics Olympiad: “We have a number (integer) with 6 as the last (right-most) digit (936 for example). If we erase the 6 and put it on the left end of the number (693 in our example), then we have a number four times our original number. We see that 936 doesn’t work. What is the smallest number that does fit the above conditions?” For this problem, we slightly generalize this puzzle: We have an N-base number (integer) with X as the last (right-most) digit. If we erase the X and put it on the left end of the number, then we have another N-base number which is Y times our original number. Given N (in [2,256]), X and Y , what is the smallest number that does fit the above conditions? Input There will be no more than 1000 cases. Each test case will consist of exactly three integers in a line, giving the values of N, X and Y respectively. Output For each case, print the case number, followed by the digits in the target number, each digit separated by a single space. If there is no solution, print a message ‘No solution’ for that case. Sample Input 10 6 4 10 3 1 123 31 3 Sample Output Case 1: 1 5 3 8 4 6 Case 2: 3 Case 3: 10 44 55 100 74 65 103 116 79 108 77 25 90 71 23 89 111 119 39 95 31 92 71 105 117 39 13 4 42 55 18 47 15 87 29 9 85 28 50 57 101 33 93 31