P1143 Base Conversion
Description
Write a program to convert a number between two different bases.
Input Format
There are three lines. The first line is a positive integer denoting the base of the given number, $n\ (2\le n\le 16)$. The second line is a base-$n$ number; if $n>10$, use uppercase letters $\verb!A!\sim \verb!F!$ for digits $10\sim 15$, and the decimal value of this base-$n$ number does not exceed $10^9$. The third line is also a positive integer denoting the target base, $m\ (2\le m\le 16)$.
Output Format
A single positive integer, which is the number in base $m$ after conversion.
Explanation/Hint
Translated by ChatGPT 5