A,B,c=int(input()),int(input()),"" while B:c+=str(B%A);B//=A; print(reversed(c))