Problem: 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 d buttons with digits from 0 to d - 1. 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 n 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.

Input

The first line contains two integers d and n (1 ≤ d ≤ 10; 1 ≤ n ≤ 2^d - 1). Next n lines describe possible passwords. Each line contains a string s_i of d zeros and ones: for all j from 1 to d the j-th character is 1 iff the button with the digit j - 1 must be pushed down.

All strings s_i are different, and each string contains at least one 1.

Output

On the first line, print the number k — the minimum number of button presses. On the second line, print k tokens, describing the sequence. Whenever you press a button with a digit, print that digit. Whenever you press "RESET", print "R".

Examples

Input


2 2
10
11


Output


2
0 1 


Input


3 4
001
111
101
011


Output


6
2 0 R 1 2 0 

Note

In the second example, the sequence 1 2 R 2 0 1 is also possible.

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
const int N=1<<11;
bool vis[N];
int match[N],nxt[N],pre[N];
vector<int> G[N];
bool find(int u){
	for(auto& v:G[u]){
		if(vis[v])continue;
		vis[v]=true;
		if(match[v]==-1||find(match[v])){
			match[v]=u,match[u]=v;
			return true;
		}
	}
	return false;
}
int main(){
	int d,n;cin>>d>>n;
	vector<vector<int>>layer(d+1);
	vector<int>v(n);
	for(int i=0;i<n;i++){
		string s;cin>>s;
		int one=0,res=0;
		for(auto& j:s){
			one+=j=='1';
			res=2*res+j-'0';
		}
		layer[one].push_back(i);
		v[i]=res;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(j==i)continue;
			if((v[i]&v[j])==v[j]){
				G[j].push_back(i+n);
			}
		}
	}
	memset(match,-1,sizeof match);
	int ans=0;
	for(int i=d;i>=0;i--){
		for(auto& j:layer[i]){
			memset(vis,0,sizeof vis);
			ans+=find(j);	
		}
	}
	cerr<<ans<<endl;
	vector<int>start;
	memset(pre,-1,sizeof pre);
	memset(nxt,-1,sizeof nxt);
	for(int i=0;i<n;i++){
		if(match[i]!=-1){	
			pre[match[i]-n]=i;
			nxt[i]=match[i]-n;
		}
	}
	for(int i=0;i<n;i++){
		if(pre[i]==-1){
			start.push_back(i); 
		}
	}
	vector<char> res;
	while(!start.empty()){
		int cur=0;
		int ind=start.back();
		start.pop_back();
		while(ind!=-1){
			for(int j=0;j<d;j++){
				if(cur&(1<<j))continue;
				if(v[ind]&(1<<j)){
					//cout<<"???"<<j<<endl;
					res.emplace_back(d-j-1+'0');
				}
			}
			assert(__builtin_popcount(cur)<__builtin_popcount(v[ind]));
			cur=v[ind];
			ind=nxt[ind];
		}
		res.push_back('R');
	}
	assert(!res.empty());
	res.pop_back();
	cout<<res.size()<<endl;
	for(auto& i:res)cout<<i<<' ';
}