LearnPy Hub
← Data Types & Casting problems
Hard

Convert Between Bases

Read a number written in base b1 and convert it to base b2 (2 ≤ b1, b2 ≤ 36, digits 0-9 then A-Z). Use int(text, b1) to read it, then build the digits of the new base yourself. Print the result in capitals.

Input

A number, then b1 and b2 on one line.

Output

One line.

Sample 1

Input
255
10 16
Output
FF

Sample 2

Input
ff
16 2
Output
11111111
solution.py
Output appears here
Convert Between Bases · Python practice problem · LearnPy Hub