Alternative Scale of Notation

No attempts yetTime limit1sMemory limit128 MB

Problem

We can map strings over an alphabet ΣB={C1,C2,,CB}\Sigma_B = \{C_1, C_2, \dots, C_B\} of size BB to non-negative integers. Treat the characters as digits C1=0,C2=1,,CB=B1C_1 = 0, C_2 = 1, \dots, C_B = B - 1 and read the string as a base-BB numeral. Call this map UBU_B: for a string α[1..n]\alpha[1..n] of length nn,

UB(α)=i=0n1α[ni]Bi.U_B(\alpha) = \sum_{i=0}^{n-1} \alpha[n-i] \cdot B^i.

For example, U3(1001)=127+09+03+11=28U_3(1001) = 1 \cdot 27 + 0 \cdot 9 + 0 \cdot 3 + 1 \cdot 1 = 28.

This correspondence has a serious drawback: it is not one-to-one. For example,

28=U3(1001)=U3(01001)=U3(001001)=,28 = U_3(1001) = U_3(01001) = U_3(001001) = \dots,

so infinitely many strings map to 2828.

To avoid this, we use an alternative interpretation. We still read characters as digits, but shifted by one: C1=1,C2=2,,CB=BC_1 = 1, C_2 = 2, \dots, C_B = B. There is no digit 00 anymore; instead there is a digit BB. We define the map VBV_B in the same shape: for a string α[1..n]\alpha[1..n] of length nn,

VB(α)=i=0n1α[ni]Bi.V_B(\alpha) = \sum_{i=0}^{n-1} \alpha[n-i] \cdot B^i.

For the empty string ϵ\epsilon we set VB(ϵ)=0V_B(\epsilon) = 0.

This looks a lot like UBU_B, but the digit set is different. For example, V3(1313)=127+39+13+31=60V_3(1313) = 1 \cdot 27 + 3 \cdot 9 + 1 \cdot 3 + 3 \cdot 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 VBV_B: given an integer xx, find the string α\alpha such that VB(α)=xV_B(\alpha) = x.

Input

The first line contains BB (2B92 \le B \le 9).

The second line contains an integer xx written in ordinary decimal notation, with 0x101000 \le x \le 10^{100}.

Output

Print a string α\alpha consisting only of digits from {1,2,,B}\{1, 2, \dots, B\} such that VB(α)=xV_B(\alpha) = x. The answer is unique. When x=0x = 0, the string is empty, so print nothing.