# Shifted Coefficient Number System

Let us define the Shifted Coefficient Number System as a number system that has B base and uses the coefficients L, L + 1, L + 2,... , L + B − 1. As you’d soon find out if certain constraints are not met it would not be possible to express all integers in the SCNS. For this problem you’d have to find the SCNS representation of integers given in Decimal Number System, and when the representation is not possible you’d state so. Input There can be multiple test cases. Each test case consists of 3 integers: B, 1 < B < 17 the base for the number system, L, |L| < 10 the least valued coefficient in the number system and N , |N | < 215 − 1 a number given in Decimal Number System. Output For each of test cases, print two lines. The first line would be of format: ‘CASE# x:’ where x is the test case number (starting at 1). In the next line print a SCNS representation of the number in the following format: cn ∗ Bn cn−1 ∗ Bn−1 . . . c0 ∗ B0 = N If there are multiple solutions print the one that uses the least number of coefficients. For two numbers in SCNS Pa and Pb, Pa gets preference over Pb when Cai < Cbi, and Cai = Cbi for all i = n . . . i − 1. In other words between two representation of a number with same number of coefficients choose the one that has the smallest most significant digit (if they are equal then the smallest next significant digit and so on...). None of the representations should use more than 15 coefficients. If it is not possible to represent the number in SCNS with 15 or less coefficients, then print the words ‘NOT REPRESENTABLE’. Sample Input 205 215 225 Sample Output CASE# 1: +12^2+02^1+12^0 = 5 CASE# 2: +22^1+1*2^0 = 5 CASE# 3: NOT REPRESENTABLE