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>

#define ll long long
#define x first
#define y second
#define sz(a) ((int)(a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
#define FORD(i, a, b) for(int i=a, _n=b; i>=_n; --i)
#define REP(i, _n) for(int i=0; i<_n; ++i)
#define vi vector<int>
#define rep(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
using namespace std;

const int N = 2e3, INF = 1e8;
int n, d, vis[N], mch[N];
string s[N];
vector<vector<int> > a;

pair<int, vector<pair<int, int>>> hungarian(const vector<vi> &A) {
    int n = A.size(), m = A[0].size();

    vector<int> u (n+1), v (m+1), p (m+1), way (m+1);
    for (int i=1; i<=n; ++i) {
        p[0] = i;
        int j0 = 0;
        vector<int> minv (m+1, INF);
        vector<char> used (m+1, false);
        do {
            used[j0] = true;
            int i0 = p[j0],  delta = INF,  j1;
            for (int j=1; j<=m; ++j)
                if (!used[j]) {
                    int cur = A[i0-1][j-1]-u[i0]-v[j];
                    if (cur < minv[j])
                        minv[j] = cur,  way[j] = j0;
                    if (minv[j] < delta)
                        delta = minv[j],  j1 = j;
                }
            for (int j=0; j<=m; ++j)
                if (used[j])
                    u[p[j]] += delta,  v[j] -= delta;
                else
                    minv[j] -= delta;
            j0 = j1;
        } while (p[j0] != 0);
        do {
            int j1 = way[j0];
            p[j0] = p[j1];
            j0 = j1;
        } while (j0);
    }

    vector<pair<int, int>> result;
    for (int i = 1; i <= m; ++i){
      result.push_back(make_pair(p[i], i));
    }

    int C = -v[0];

    return mp(C, result);
}
int main()
{
    ios::sync_with_stdio();
    cin.tie(0); cout.tie(0);
    // freopen("a.inp","r",stdin);

    cin >> d >> n;
    REP(i, n) cin >> s[i];

    a.assign(n, vector<int> (n, 0));

    REP(i, n) REP(j, n) {
        int value = 1;
        REP(k, d) {
            if (s[i][k] == '0' && s[j][k] == '1') value = 0;
            if (s[i][k] == '1' && s[j][k] == '1') a[i][j] -= 1;
        }
        if (!value || i == j) a[i][j] = 0;
    }

    auto tmp = hungarian(a);

    for(auto x: tmp.y) if (a[x.x-1][x.y-1]) {
        mch[x.y] = x.x;
    }

    vector<int> ans;
    FOR(i, 1, n) vis[mch[i]] = 1;
    FOR(i, 1, n) if (!vis[i]) {
        REP(k, d) if (s[i-1][k] == '1') ans.pb(k);
        for(int j=i; mch[j]!=0; j=mch[j]) {
            REP(k, d) if (s[j-1][k] != s[mch[j]-1][k]) ans.pb(k);
        }
        ans.pb(-1);
    }
    ans.pop_back();
    cout << ans.size() << endl;
    for(int x: ans) if (x!=-1) cout << x <<' '; else cout << 'R' <<' ';
}