from numpy import base_repr n = int(input()) m = int(input()) print(base_repr(m, n))