Problem 3 - Negative Bases

Introduction

Our decimal number system is a place value system with a base of 10, meaning the value of the places are powers of 10. For example, 3215 = 3 * 103 + 2 * 102 + 1 * 101 + 5 + 100. The 5 is said to be the least significant digit, or in the 1's place. The 1 is in the 10's place, the 2 is in the 100's place, and the most significant digit is the one in the 1000's place.

To convert a number n into base b one must find the unique sequence of digits d0, d1, d2, ... such that n = d0 * b0 + d1 * b1 + d2 * b2... and each di is between 0 and b-1 inclusive. Note that in some bases we run out of symbols to use for digits. For example, we need sixteen different digits for hexadecimal (base 16), so we use letters A through F in addition to 0 through 9.

When b=2 we have the binary number system where the legal digits are 0 and 1. 321510 = 1100100011112 since 3215 = 1 * 211 + 1 * 210 + 0 * 29 + 0 * 28 + 1 * 27 + 0 * 26 + 0 * 25 + 0 * 24 + 1 * 23 + 1 * 22 + 1 * 21 + 1 * 20.

Unique representation also works for any base b that is a negative odd integer less than -1. Here the valid digits are (b + 1) / 2 through (-b - 1) / 2. In other words, given an integer n one can find the unique sequence of integers d0, d1, d2, ... such that n = d0 * b0 + d1 * b1 + d2 * b2... and each di has an absolute value less than (-b-1)/2 (so we are using negative numbers for digits much like how we use letters for digits in hexadecimal).

So for b = -5 the digits must be between -2 and 2 inclusive. We let d5 = -1, d4 = 0, d3 = -1, d2 = -1, d1 = 2, d0 = 0 and write 321510 as (-1 0 -1 -1 2 0)-5 since 3215 = -1 * (-5)5 + 0 * (-5)4 + -1 * (-5)3 + -1 * (-5)2 + 2 * (-5)1 + 0 * (-5)0.

The representation of a number in a negative base can be found by the following steps:

For example, to find the base -5 representaion of 3215, we first find its representation in base 5 (using digits 0 through 4), then negate the digits in the 5's, 125's, and 3125's places, and finally adjust the digits so they are all in the valid -2 to 2 range:

Input

The first line of input will be an odd negative integer other than -1. The second line of input will be a positive integer. There will be no extra spaces on either line.

Output

The output must be a list of the digits used in the representation of the positive integer given in the input using the negative base given in the input. The digits must be listed from most significant to least significant (in other words, the 1's place must be given last) and must be separated by a single space. There must be no leading zeros in the output.

Example

Input:

-5
1562

Output:

2 -2 2 -2 2