De Bruijn Cycle High#4575

De Bruijn Cycle High

1 second
256 megabytes
Medium

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 any sequence b_0, b_1, \ldots, b_{n-1} from , there exists a unique index (0 \leq k < l) such that b_j = a_{(k + j) \bmod l} for all . Construct such a sequence.

Constraints

The integers and satisfy: 1 \leq n \leq 1000, 1 \leq b \leq 10, and b^n \leq 10^7.

Input

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

Output

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

Examples

Example 1

Loading
Loading