eolymp
bolt
Try our new interface for solving problems
Problems

Number systems

Number systems

Given a nonnegative integer in the \textbf{m}-th system of calculation. Need to bring this number in the \textbf{k}-th system of calculation. \InputFile The input file in the first line contains two numbers \textbf{m} and \textbf{k} (in decimal), the second line - the number for the transfer. \textbf{2} ≤ \textbf{m}, k ≤ \textbf{36}, for submission to the number \textbf{10}...\textbf{35} use capital letters \textbf{A}...\textbf{Z}, respectively, the number of bits of the initial number does not exceed \textbf{1000}. \OutputFile Bring in the output file the required number without leading zeros.
Time limit 1 second
Memory limit 64 MiB
Input example #1
10 36
29234652
Output example #1
HELLO