Contacts
Two Worlds have established contact and found that they can understand each other's digitized thoughts perfectly. However, full communication is hindered by one issue: one World uses a positional numeral system with base p, while the other uses a system with base q, and these bases differ. Our task is to facilitate their communication.
Input
The input consists of two numbers, p and q (both in decimal form), followed by a single line containing a digitized message (a number) in the base p system. The message can be up to 1000 characters long. The constraints are 2 ≤ p, q ≤ 16, and p ≠ q. For digits greater than 9, uppercase Latin letters are used.
Output
The output should be a single line representing the value of the given number in the base q system, without leading zeros. For digits greater than 9, use the appropriate uppercase Latin letters.