10097 - decimal to ternary   

Description

Input two positive integers, X and Y. The task is to translate the decimal number X into Y digits ternary (三進位) number, and output the Y digits ternary number.

X is smaller than 1000 and Y is smaller than 8.

Input

 Two positive integers, X and Y.  X is smaller than 1000 and Y is smaller than 8.

 

Output

The Y digits ternary representation of the input number X.

Note that you need to print a '\n' at the end of the bit string.

 

Sample Input  Download

Sample Output  Download

Tags

10401HW3



Discuss