You are standing in front of the room with great treasures. The only thing stopping you is the door with a push-button combination lock. This lock has buttons with digits from to . Whenever you press a button, it stays pushed down. You can not pop back up just one button, but there is a "RESET" button --- pressing it pops up all other buttons. Initially, no buttons are pushed down.
The door instantly opens when some specific set of digits is pushed down. Sadly, you don't know the password for it. Having read the documentation for this specific lock, you found out that there are possible passwords for this particular lock.
Find the shortest sequence of button presses, such that all possible passwords appear at least once during its execution. Any shortest correct sequence of button presses will be accepted.
输入格式
The first line contains two integers and (; ).
Next lines describe possible passwords. Each line contains a string of zeros and ones: for all from to the -th character is iff the button with the digit must be pushed down.
All strings are different, and each string contains at least one .
输出格式
On the first line, print the number --- the minimum number of button presses.
On the second line, print tokens, describing the sequence. Whenever you press a button with a digit, print that digit. Whenever you press "RESET", print .
样例
样例输入 1
2 2
10
11
样例输出 1
2
0 1
样例输入 2
3 4
001
111
101
011
样例输出 2
6
2 0 R 1 2 0
数据范围与提示
In the second example, the sequence is also possible.