m = int(input()) n = int(input()) ans = [] while(n): ans.append(str(n % m)) n //= m print(''.join(ans[::-1]))