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;
typedef long long ll;
const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const long double PI = 3.14159265359;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}
#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()
#define lg2(x) 31-__builtin_clz(x)
#define hash sodnf9843bsd
#define left ldkfjn43ofjosamdg
#define right iadjfof23n3okd
#define pqueue priority_queue
#define pb push_back
#define mp make_pair
#define mtp make_tuple
#define endl '\n'

const int maxn = 1e3+123;

int vis[maxn+11];
int mt[maxn+11];
vector<int> g[maxn+11];

bool kuhn(int v, int t){
    if (vis[v] == t) return false;
    vis[v] = t;

    for(int u:g[v]){
        if (mt[u] == -1 || kuhn(mt[u], t)){
            mt[u] = v;
            return true;
        }
    }
    return false;
}

int nxt[maxn];
int in[maxn];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    for(int i = 0;i < maxn;i++) {
        mt[i] = -1;
        vis[i] = -1;
    }

    int d, n;cin>>d>>n;
    vector<int>mask;
    _fk(n){
        string s;cin>>s;
        int m = 0;
        for(int i = 0;i < sz(s);i++){
            if (s[i] == '1') m += 1<<i;
        }
        mask.pb(m);
    }

    sort(all(mask), [](int a, int b){
        return __builtin_popcount(a) > __builtin_popcount(b);
    });

    _fi(n)_fj(n){
        if (i == j) continue;
        if ((mask[i]&mask[j]) == mask[i]) g[i].pb(j);
    }

    _fi(n) kuhn(i, i);
    _fi(n) nxt[i] = i;
    _fi(n){
        if (mt[i] == -1) continue;
        in[i]++;
        nxt[mt[i]] = i;
    }

    vector<char>ans;
    _fi(n){
        if (in[i] == 0){
            int a = i;
            vector<int>masks;
            while(nxt[a] != a){
                masks.pb(mask[a]);
                a = nxt[a];
            }
            masks.pb(mask[a]);

            int s = 0;
            for(int m:masks){
                int ex = m^s;
                for(int bit = 0;bit < d;bit++){
                    if (ex&(1<<bit)) ans.pb(char('0'+bit));
                }
                s |= m;
            }
            ans.pb('R');
        }
    }

    ans.pop_back();
    cout << sz(ans) << endl;
    for(char c:ans) cout << c << " ";

    return 0;
}