r=io.read while''do n=r'*n'b=r()s=''while n>0 do s=n%b..s n=n/b-n/b%1 end print(s)end