Page not loading? Try clicking here.
Placeholder

#1534

Decimal number to base 2, 8, or 16 1s 32MB

Problems

Write a program that converts a given decimal number to base 2, 8, or 16.


Input

The first line contains two integers separated by a space: the decimal number N (1 ≤ N ≤ 100,000) and the base B (B is 2, 8, or 16).

For hexadecimal (base 16), numbers 10 and above are represented by 'A', 'B', 'C', 'D', 'E', 'F' in order.


Output

Print the decimal number converted to base B.


Example #1

27 2
11011

Example #2

27 16
1B

Example #3

27 8
33


Source

jungol

You must sign in to write code.