def func(number, scale):
if scale > number:
return str(number)
return func(number // scale, scale) + str(number % scale)
scale = int (input())
number = int (input())
print (str(number)+'(10)=' + str(func(number, scale)) + '(' + str(scale) + ')')
def func(number, scale):
if scale > number:
return str(number)
return func(number // scale, scale) + str(number % scale)
scale = int (input())
number = int (input())
print (str(number)+'(10)=' + str(func(number, scale)) + '(' + str(scale) + ')')