cho.sh
Notes
Loading...

Base Conversion

Time limit

2s

Memory limit

128 MB

Problem

In base b, a digit string d_k d_{k-1} ... d_0 has value d_k×b^k + d_{k-1}×b^{k-1} + ... + d_0×b^0. Each d_i is a single digit between 0 and |b|-1, inclusive.

The same definition applies when b is negative. In a negative base, the signs of place values alternate, so negative integers can be represented without a - sign.

Given a decimal integer x and a base b, output the representation of x in base b. If b is negative, the output must not contain a - sign.

Input

The first line contains two integers x and b, separated by a space.

Output

Output the representation of x in base b on the first line.

Constraints

  • -1,000,000,000 ≤ x ≤ 1,000,000,000
  • 2 ≤ |b| ≤ 10