We can map strings over an alphabet ΣB={C1,C2,…,CB} of size B to non-negative integers. Treat the characters as digits C1=0,C2=1,…,CB=B−1 and read the string as a base-B numeral. Call this map UB: for a string α[1..n] of length n,
UB(α)=∑i=0n−1α[n−i]⋅Bi.
For example, U3(1001)=1⋅27+0⋅9+0⋅3+1⋅1=28.
This correspondence has a serious drawback: it is not one-to-one. For example,
28=U3(1001)=U3(01001)=U3(001001)=…,
so infinitely many strings map to 28.
To avoid this, we use an alternative interpretation. We still read characters as digits, but shifted by one: C1=1,C2=2,…,CB=B. There is no digit 0 anymore; instead there is a digit B. We define the map VB in the same shape: for a string α[1..n] of length n,
VB(α)=∑i=0n−1α[n−i]⋅Bi.
For the empty string ϵ we set VB(ϵ)=0.
This looks a lot like UB, but the digit set is different. For example, V3(1313)=1⋅27+3⋅9+1⋅3+3⋅1=60.
It can be shown that this map is bijective (one-to-one and onto), so it has an inverse. Your task is to compute the inverse of VB: given an integer x, find the string α such that VB(α)=x.
The first line contains B (2≤B≤9).
The second line contains an integer x written in ordinary decimal notation, with 0≤x≤10100.
Print a string α consisting only of digits from {1,2,…,B} such that VB(α)=x. The answer is unique. When x=0, the string is empty, so print nothing.