De Bruijn Sequence Junior#4576

De Bruijn Sequence Junior

1 second
64 megabytes
Hard

A de Bruijn cycle of order for the set D = \{0, 1, \ldots, b - 1\} is a cyclic sequence a_0, a_1, \ldots, a_{l - 1} such that every possible vector of length over the set appears exactly once in this sequence. That is, for every sequence b_0, b_1, \ldots, b_{n - 1} from , there exists a unique in the range 0 \leq k < l such that b_j = a_{(k + j) \bmod l} for all . Your task is to construct such a sequence.

Constraints

and are integers, 1 \leq n \leq 1000, 1 \leq b \leq 10, b^n \leq 10^4.

Input

The input consists of a single line containing the numbers and .

Output

Output the de Bruijn cycle of order for the set of -ary digits as a single line, without spaces.

Examples

Example 1

Loading
Loading