시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB0000.000%

문제

Negative number bases are just like positive ones, except that every other place value is negative.

The number seven represented in base positive two is: 111 base 2. In base negative 2, however, the place values mean that 7 is represented as 11011 base -2. This is because

(1 x 16 + 1 x -8 + 0 x 4 + 1 x -2 + 1) = 7

since base 2's place values 1, -2, 4, -8, 16, etc. Note that negative number bases can represent both positive and negative integers without using a sign! So, negative number base representation does not use a sign (in this task, anyway).

Write a program to convert ordinary integers from the input to another supplied base.

입력

  • A single line with two integers: N B
    • -30000 ≤ N ≤ 30000, the number to be converted, expressed in base 10.
    • -10 ≤ B ≤ -2 or 2 ≤ B ≤ 10, the new number base.

출력

The output is a single line that contains the numerical representation of the number in the new number base.

예제 입력 1

7 -2

예제 출력 1

11011