Contacts#734

Contacts

1 second
256 megabytes
Easy

Two Worlds have established contact and discovered that they can fully understand each other's digitized thoughts. However, complete communication is hindered by one issue: one of the Worlds uses a positional numeral system with base , while the other uses a system with base , and these bases are different. Your task is to help facilitate this communication.

Input

The input consists of two numbers and (both in decimal), followed by one line: a digitized message (a number) in base . The message can be up to characters long. 2 \le p, q \le 16, p \ne q. For digits greater than , uppercase Latin letters are used.

Output

The output should be a single line representing the value of the given number in base , without leading zeros. For digits greater than , use the necessary uppercase Latin letters.

Examples

Example 1

Loading
Loading