M=int(input()) N=int(input()) import numpy as np print(np.base_repr(N, M))