import numpy as np A=int(input()) B=int(input()) print(np.base_repr(B, A))