// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    int a[1000][1000][2];
    bool p[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) x = 10;
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j][0] = 0;
                    p[i][j][1] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j) {
                 if(ans[i][j-1][0] < c) {
                    c = ans[i][j-1][0];
                    p[i][j][0] = 1;
                 }
                 if(ans[i][j-1][1] < d) {
                    d = ans[i][j-1][1];
                    p[i][j][1] = 1;
                 }
            }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    if(ans[n-1][n-1][0] < ans[n-1][n-1][1])
    while(i || j) {
        way.push_back(p[i][j][0]);
        if(p[i][j][0])
            j--;
        else
            i--;
    }
    else
    while(i || j) {
        way.push_back(p[i][j][1]);
        if(p[i][j][1])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool zero = 0;
    int kx;
    int a[1000][1000][2];
    bool p[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) {
                x = 10;
                zero = 1;
                kx = j;
            }
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j][0] = 0;
                    p[i][j][1] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j) {
                 if(ans[i][j-1][0] < c) {
                    c = ans[i][j-1][0];
                    p[i][j][0] = 1;
                 }
                 if(ans[i][j-1][1] < d) {
                    d = ans[i][j-1][1];
                    p[i][j][1] = 1;
                 }
            }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    if(ans[n-1][n-1][0] < ans[n-1][n-1][1])
    while(i || j) {
        way.push_back(p[i][j][0]);
        if(p[i][j][0])
            j--;
        else
            i--;
    }
    else
    while(i || j) {
        way.push_back(p[i][j][1]);
        if(p[i][j][1])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    if(zero && min(ans[n-1][n-1][0], ans[n-1][n-1][1])) {
    cout << 1 << endl;
    for(int i=0; i < kx; i++)
        cout << "R";
    for(int i=0; i < n-1; i++)
        cout << "D";
    for(int i=0; i < n-kx-1; i++)
        cout << "R";
    }
    else {
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    }
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((a[i][j][0]+c), (a[i][j][1]+d)) > min((a[i][j][0]+ans[i][j-1][0]), (a[i][j][1]+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", min(ans[n-1][n-1][0], ans[n-1][n-1][1]));
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int q = a[i][j][0];
            int w = a[i][j][1];
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((q+c), (w+d)) > min((q+ans[i][j-1][0]), (w+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = q + c;
            ans[i][j][1] = w + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", (min(ans[n-1][n-1][0], ans[n-1][n-1][1]) ? 1 : 0));
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(x) {
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int q = a[i][j][0];
            int w = a[i][j][1];
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((q+c), (w+d)) > min((q+ans[i][j-1][0]), (w+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = q + c;
            ans[i][j][1] = w + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", min(ans[n-1][n-1][0], ans[n-1][n-1][1]));
    for(int i=0; i < ans.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool zero = 0;
    int a[1000][1000][2];
    bool p[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) {
                x = 10;
                zero = 1;
            }
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j][0] = 0;
                    p[i][j][1] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j) {
                 if(ans[i][j-1][0] < c) {
                    c = ans[i][j-1][0];
                    p[i][j][0] = 1;
                 }
                 if(ans[i][j-1][1] < d) {
                    d = ans[i][j-1][1];
                    p[i][j][1] = 1;
                 }
            }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    if(ans[n-1][n-1][0] < ans[n-1][n-1][1])
    while(i || j) {
        way.push_back(p[i][j][0]);
        if(p[i][j][0])
            j--;
        else
            i--;
    }
    else
    while(i || j) {
        way.push_back(p[i][j][1]);
        if(p[i][j][1])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    if(zero && min(ans[n-1][n-1][0], ans[n-1][n-1][1])) {

    }
    else {
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    }
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000000, d = 1000000000;
            if(i)
                if(min((a[i][j][0]+c), (a[i][j][1]+d)) > min((a[i][j][0]+ans[i-1][j][0]), (a[i][j][1]+ans[i-1][j][1]))) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((a[i][j][0]+c), (a[i][j][1]+d)) > min((a[i][j][0]+ans[i][j-1][0]), (a[i][j][1]+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", min(ans[n-1][n-1][0], ans[n-1][n-1][1]));
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool zero = 0;
    int kx;
    int a[1000][1000][2];
    bool p[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) {
                x = 10;
                zero = 1;
                kx = j;
            }
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j][0] = 0;
                    p[i][j][1] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j) {
                 if(ans[i][j-1][0] < c) {
                    c = ans[i][j-1][0];
                    p[i][j][0] = 1;
                 }
                 if(ans[i][j-1][1] < d) {
                    d = ans[i][j-1][1];
                    p[i][j][1] = 1;
                 }
            }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    if(ans[n-1][n-1][0] < ans[n-1][n-1][1])
    while(i || j) {
        way.push_back(p[i][j][0]);
        if(p[i][j][0])
            j--;
        else
            i--;
    }
    else
    while(i || j) {
        way.push_back(p[i][j][1]);
        if(p[i][j][1])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    if(zero && min(ans[n-1][n-1][0], ans[n-1][n-1][1])) {
    cout << 1 << endl;
    for(int i=0; i < kx; i++)
        cout << "R";
    for(int i=0; i < n-1; i++)
        cout << "D";
    for(int i=0; i < n-kx; i++)
        cout << "R";
    }
    else {
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    }
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool zero = 0;
    int kx;
    int a[1000][1000][2];
    bool p[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) {
                x = 10;
                zero = 1;
                kx = j;
            }
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j][0] = 0;
                    p[i][j][1] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j) {
                 if(ans[i][j-1][0] < c) {
                    c = ans[i][j-1][0];
                    p[i][j][0] = 1;
                 }
                 if(ans[i][j-1][1] < d) {
                    d = ans[i][j-1][1];
                    p[i][j][1] = 1;
                 }
            }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    if(ans[n-1][n-1][0] < ans[n-1][n-1][1])
    while(i || j) {
        way.push_back(p[i][j][0]);
        if(p[i][j][0])
            j--;
        else
            i--;
    }
    else
    while(i || j) {
        way.push_back(p[i][j][1]);
        if(p[i][j][1])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    if(zero && min(ans[n-1][n-1][0], ans[n-1][n-1][1])) {
    for(int i=0; i < kx; i++)
        cout << "R";
    for(int i=0; i < n-1; i++)
        cout << "D";
    for(int i=0; i < n-kx; i++)
        cout << "R";
    }
    else {
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    }
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(x) {
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int q = a[i][j][0];
            int w = a[i][j][1];
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((q+c), (w+d)) > min((q+ans[i][j-1][0]), (w+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = q + c;
            ans[i][j][1] = w + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", min(ans[n-1][n-1][0], ans[n-1][n-1][1]));
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(!x) x = 10;
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((a[i][j][0]+c), (a[i][j][1]+d)) > min((a[i][j][0]+ans[i][j-1][0]), (a[i][j][1]+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = a[i][j][0] + c;
            ans[i][j][1] = a[i][j][1] + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    cout << min(ans[n-1][n-1][0], ans[n-1][n-1][1]) << endl;
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n, x;
    scanf("%d", &n);
    bool p[1000][1000];
    int a[1000][1000][2];
    int ans[1000][1000][2];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++) {
            scanf("%d", &x);
            a[i][j][0] = 0;
            a[i][j][1] = 0;
            if(x) {
            while(x % 2 == 0) {
                a[i][j][0]++;
                x /= 2;
            }
            while(x % 5 == 0) {
                a[i][j][1]++;
                x /= 5;
            }
            }
        }
    ans[0][0][0] = a[0][0][0];
    ans[0][0][1] = a[0][0][1];
    for(int i=0; i < n; i++)
        for(int j=0; j < n; j++)
            if(i || j) {
            int q = a[i][j][0];
            int w = a[i][j][1];
            int c = 1000000, d = 1000000;
            if(i) {
                    p[i][j] = 0;
                    c = ans[i-1][j][0];
                    d = ans[i-1][j][1];
                    }
            if(j)
                if(min((q+c), (w+d)) > min((q+ans[i][j-1][0]), (w+ans[i][j-1][1]))) {
                    p[i][j] = 1;
                    c = ans[i][j-1][0];
                    d = ans[i][j-1][1];
                    }
            ans[i][j][0] = q + c;
            ans[i][j][1] = w + d;
        }
    int i=n-1, j=n-1;
    vector <bool> way;
    while(i || j) {
        way.push_back(p[i][j]);
        if(p[i][j])
            j--;
        else
            i--;
    }
    reverse(way.begin(), way.end());
    printf("%d\n", min(ans[n-1][n-1][0], ans[n-1][n-1][1]));
    for(int i=0; i < way.size(); i++)
        cout << (way[i] ? "R" : "D");
    //system("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
#include <unordered_map>

using namespace std;

int get2(int num) {
    if ( num == 0 ) return 1000;
    int res = 0;
    while ( ((num >> res) & 1) == 0 ) res ++;
    return res;
}

int get5(int num) {
    if ( num == 0 ) return 1000;
    int res = 0;
    while ( num % 5 == 0 ) {
        num /= 5;
        res ++;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    int square[N][N];
    int x, y;
    bool hasZero = false;
    for (int i = 0; i < N; i ++)
        for (int j = 0; j < N; j ++)  cin >> square[i][j];

    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < N; j ++) {
            if ( square[i][j] == 0 ) {
                hasZero = true;
                x = i;
                y = j;
                break;
            }
        }
        if ( hasZero ) break;
    }

    int dp22[N][N];
    int dp25[N][N];
    char dp2[N][N];

    int dp52[N][N];
    int dp55[N][N];
    char dp5[N][N];

    dp22[0][0] = dp52[0][0] = get2(square[0][0]);
    dp25[0][0] = dp55[0][0] = get5(square[0][0]);
    for (int i = 1; i < N; i ++) {
        dp2[0][i] = dp5[0][i] = 'l';
        dp2[i][0] = dp5[i][0] = 'u';

        dp22[0][i] = dp22[0][i - 1] + get2(square[0][i]);
        dp25[0][i] = dp25[0][i - 1] + get5(square[0][i]);
        dp55[0][i] = dp55[0][i - 1] + get5(square[0][i]);
        dp52[0][i] = dp52[0][i - 1] + get2(square[0][i]);

        dp22[i][0] = dp22[i - 1][0] + get2(square[i][0]);
        dp25[i][0] = dp25[i - 1][0] + get5(square[i][0]);
        dp55[i][0] = dp55[i - 1][0] + get5(square[i][0]);
        dp52[i][0] = dp52[i - 1][0] + get2(square[i][0]);
    }
//  cout << "go" << endl;
    for (int i = 1; i < N; i ++) {
        for (int j = 1; j < N; j ++) {
            int twoL = dp22[i][j - 1] + get2(square[i][j]);
            int twoU = dp22[i - 1][j] + get2(square[i][j]);
            int fivL = dp55[i][j - 1] + get5(square[i][j]);
            int fivU = dp55[i - 1][j] + get5(square[i][j]);
            if ( twoL <= twoU ) {
                dp2[i][j] = 'l';
                dp22[i][j] = twoL;
                dp25[i][j] = dp25[i][j - 1] + get5(square[i][j]);
            } else {
                dp2[i][j] = 'u';
                dp22[i][j] = twoU;
                dp25[i][j] = dp25[i - 1][j] + get5(square[i][j]);
            }
            if ( fivL <= fivU ) {
                dp5[i][j] = 'l';
                dp55[i][j] = fivL;
                dp52[i][j] = dp52[i][j - 1] + get2(square[i][j]);
            } else {
                dp5[i][j] = 'u';
                dp55[i][j] = fivU;
                dp52[i][j] = dp52[i - 1][j] + get2(square[i][j]);
            }
        }
    }
    /*
    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < N; j ++)
            cout << dp2[i][j] << " ";
        cout << endl;
    }
    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < N; j ++)
            cout << dp5[i][j] << " ";
        cout << endl;
    }
    */

    int p1 = min(dp22[N - 1][N - 1], dp25[N - 1][N - 1]);
    int p2 = min(dp55[N - 1][N - 1], dp52[N - 1][N - 1]);
    string path;
    if ( p1 <= p2 ) {
        int i = N - 1, j = N - 1;
        while ( i || j ) {
            if ( dp2[i][j] == 'l' ) {
                path.push_back('R');
                j --;

            } else {
                path.push_back('D');
                i --;
            }
        }

    } else {
        int i = N - 1, j = N - 1;
        while ( i || j ) {
            if ( dp5[i][j] == 'l' ) {
                path.push_back('R');
                j --;

            } else {
                path.push_back('D');
                i --;
            }
        }
    }
    reverse(path.begin(), path.end());
    if ( hasZero && min(p1, p2) > 1 ) {
//      cout << "ze" << x << "," << y << endl;
        int i, j;
        cout << 1 << endl;
        for (i = 0; i < x; i ++) cout << "D";
        for (j = 0; j < N - 1; j ++) cout << "R";
        for (; i < N - 1; i ++) cout << "D";
        cout << endl;
        return 0;
    }

    cout << min(p1, p2) << endl;
    cout << path << endl;
    return 0;
}


#include <iostream>
#include <cctype>
#include <string>
#include <algorithm>
using namespace std;

bool isnum(char c) {
	return '0' <= c && c <= '9';
}
bool isEasy(const string &str) {
	if ( str[0] != 'R' ) return false;
	if ( !isnum(str[1]) ) return false;
	for (size_t i = 2; i < str.length(); i ++) {
		if ( !isnum(str[i]) ) return true;
	}
	return false;
}
size_t toNum(const string &col) {
	size_t num = 0;
	for (size_t i = 0; i < col.length(); i ++) {
		num *= 26;
		num += col[i] - 'A' + 1;
	}
	return num;
}
string toCol(size_t col) {
	string res;
	while ( col ) {
		size_t k = col % 26;
		col /= 26;
		if ( k == 0 ) {
			k = 26;
			if ( col > 0 ) col --;
		}
		res.push_back(char('A' + k - 1));
	}
	reverse(res.begin(), res.end());
	return res;
}

string toString(size_t num) {
	string res;
	while ( num ) {
		size_t k = num % 10;
		num /= 10;
		res.push_back(char('0' + k));
	}
	if ( res.length() == 0 ) res.push_back('0');
	reverse(res.begin(), res.end());
	return res;
}

string toEasy(const string &hard) {
	size_t i;
	for (i = 0; i < hard.length(); i ++)
		if ( isnum(hard[i]) ) break;
	string res = "R";
	size_t col = toNum(hard.substr(0, i));
	size_t row = atoi(hard.substr(i).c_str());
	res += toString(row);
	res += "C";
	res += toString(col);
	return res;
}
string toHard(const string &easy) {
	size_t i;
	for (i = 1; i < easy.length(); i ++)
		if ( !isnum(easy[i]) ) break;
	size_t col = atoi(easy.substr(i + 1).c_str());
	string res = toCol(col);
	res += easy.substr(1, i - 1);
//	cout << ":" << res << endl;
	return res;
}

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i ++) {
		string line;
		cin >> line;
		if ( isEasy(line) ) {
			cout << toHard(line) << endl;
		} else {
			cout << toEasy(line) << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		for (int i=0;i<m-n;++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		/*if (m<=n+1){
			for (int i=0;i<n;++i)
			cout << "10";
			if (m!=n)
				cout << "1";
			return 0;
		}*/
		for (int i=0;i<m-n;++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		for (int i=0;i<m-2*n;++i)
			cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		if (m<=n+1){
			for (int i=0;i<n;++i)
			cout << "10";
			if (m!=n)
				cout << "0";
		}
		for (int i=0;i<min(n,m/2);++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		for (int i=0;i<min(n,m/2);++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		if (m<=n+1){
			for (int i=0;i<n;++i)
			cout << "10";
			if (m!=n)
				cout << "1";
		}
		for (int i=0;i<min(n,m/2);++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		if (m<=n+1){
			for (int i=0;i<n;++i)
			cout << "10";
			if (m!=n)
				cout << "1";
			return 0;
		}
		int x=min(n,m/2);
		int y=min(m-2*x,n-x);
		for (int i=0;i<x;++i)
			cout << "110";
		for (int i=0;i<y;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	if (n>m+1 || m>2*n+2){
		cout << -1;
		return 0;
	}
	if (m>=n){
		if (m<=n+1){
			for (int i=0;i<n;++i)
			cout << "10";
			if (m!=n)
				cout << "1";
			return 0;
		}
		for (int i=0;i<min(n,m/2);++i)
			cout << "110";
		for (int i=0;i<2*n-m;++i)
			cout << "10";
		if (m>2*n)
			for (int i=0;i<m-2*n;++i)
				cout << "1";
	}
	else{
		for (int i=0;i<m;++i)
			cout << "01";
		if (m!=n)
			cout << "0";
	}
}


#include<cstdio>

int n, m, p, k;

int main () {
    scanf ("%d%d", &n, &m);
    if (n>m+1 || n*2+2<m) {
        printf ("-1");
        return 0;
    }
    while (n||m) {
        if (p==0 || m>=n && k<2 ) p=1, m--, k++;
        else p=0, k=0, n--;
        printf ("%d", p);
    }
    return 0;
}


#include<cstdio>

int n, m, p, k;

int main () {
    scanf ("%d%d", &n, &m);
    if (n+1>m || n*2+2<m) {
        printf ("-1");
        return 0;
    }
    while (n||m) {
        if (p==0 || m>=n && k<2 ) p=1, m--, k++;
        else p=0, k=0, n--;
        printf ("%d", p);
    }
}
#include <cstdio>

int n, m, p = 1, k;

int main () {
    scanf("%d%d", &n, &m); /// n 0, m 1
    if (n * 2 + 2 < m || n > m + 1) {  /// chuan me luon
        puts("-1");
        return 0;
    }
    while (n || m) {
        if ((m > n && k < 2))
            --m, p = 1, ++k;
        else
            --n, p = k = 0;
        putchar(p + 48); //printf ("\n");
    }
    return 0;
}


#include <cstdio>

int n, m, p = 1, k;

int main () {
    scanf("%d%d", &n, &m); /// n 0, m 1
    if (n * 2 + 2 < m || n > m + 1) {  /// chuan me luon
        puts("-1");
        return 0;
    }
    while (n || m) {
        if ((m > n && k < 2))
            --m, p = 1, ++k;
        else
            --n, p = k = 0;
        putchar(p + 48); //printf ("\n");
    }
    return 0;
}


#include <cstdio>

int n, m, p = 1, k;

int main () {
    scanf("%d%d", &n, &m); /// n 0, m 1
    if (n * 2 + 2 < m || n > m + 1) {  /// chuan me luon
        puts("-1");
        return 0;
    }
    while (n || m) {
        if (p!=1 || (m >= n && k < 2))
            --m, p = 1, ++k;
        else
            --n, p = k = 0;
        putchar(p + 48); //printf ("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,m; // n: #0, m: #1
    string s;
    while(cin >> n >> m)
    {
        s = "";
        // Build strings "101"
        while(n > 0 && m > 1)
        {
            n--; m -= 2;
            s += "101";
        }
        // Build strings "01"
        while(n > 0 && m > 0)
        {
            n--; m--;
            s += "10";
        }
        // We only have space for two "1" at each side of the string
        if(n == 0 && m <= 2)
        {
            if(m == 1)
                s += "1";
            else if(m == 2)
                s = "1" + s + "1";
        }
        else
            s = "-1";
        // Print answer
        cout << s << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

string solve(int pn, int pm)
{
    string s;
    int n,m;
    bool go;

    s = ""; n = pn; m = pm;
    go = false;
    while(n > 0 && m > 0)
    {
        if(m && !go) { s = s + "1"; m--; go = true; if(m) { s = s + "1"; m--; } }
        if(n &&  go) { s = s + "0"; n--; go = false; }
    }
    if(!n && !m)
        return s;

    s = ""; n = pn; m = pm;
    go = true;
    while(n > 0 && m > 0)
    {
        if(m && !go) { s = s + "1"; m--; go = true; if(m) { s = s + "1"; m--; } }
        if(n &&  go) { s = s + "0"; n--; go = false; }
    }
    if(!n && !m)
        return s;

    s = ""; n = pn; m = pm;
    go = true;
    while(n > 0 && m > 0)
    {
        if(n && go) { s = s + "0"; n--; go = false; }
        if(m && !go) { s = s + "1"; m--; go = true; if(m) { s = s + "1"; m--; } }
    }
    if(!n && !m)
        return s;

    s = ""; n = pn; m = pm;
    go = false;
    while(n > 0 && m > 0)
    {
        if(n && go) { s = s + "0"; n--; go = false; }
        if(m && !go) { s = s + "1"; m--; go = true; if(m) { s = s + "1"; m--; } }
    }
    if(!n && !m)
        return s;

    return "-1";
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m; // n: # of 0, m: # of 1
    while(cin >> n >> m)
        cout << solve(n,m) << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m; // n: # of 0, m: # of 1
    string s;
    while(cin >> n >> m)
    {
        s = "";
        while(n >= 1 && m >= 2)
        {
            s += "101";
            n--;
            m -= 2;
        }

        if(n == 0 && m == 0);
        else if(m == 1)
            s = "1" + s;
        else if(m == 2)
            s = "1" + s + "1";
        else if(n == 1)
            s = "0" + s;
        else if(n == 2)
            s = "0" + s + "0";
        else
            s = "-1";

        cout << s << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,m; // n: #0, m: #1
    string s;
    while(cin >> n >> m)
    {
        s = "";
        // Build strings "110"
        while(n >= 1 && m >= 2)
        {
            n--; m -= 2;
            s += "110";
        }
        // Fit the rest
        while(n >= 1 && m >= 1)
        {
            n--; m--;
            s += "10";
        }
        if(m == 1) { m--; s += "1"; }
        if(m == 2) { m -= 2; s += "11"; }
        // If we have more characters, it is impossible
        if(n > 0 || m > 0)
            s = "-1";
        // Print answer
        cout << s << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,p; // n: #0, m: #1
    string s;
    while(cin >> n >> m)
    {
        s = "";
        p = 1;
        if(m) { m--; s = "1"; }
        // Build strings "101"
        while(n > 0 && m > 1)
        {
            n--; m -= 2;
            s += "101";
        }
        // Fit the rest
        while(n > 0 && m > 0)
        {
            n--; m--;
            s += "10";
            p = 2;
        }
        if(p == 1) { if(m) { m--; s += "1"; } }
        if(p == 2)
        {
            if(m) { m--; s += "1"; }
            if(m) { m--; s += "1"; }
        }
        // If we have more characters, it is impossible
        if(n > 0 || m > 0)
            s = "-1";
        // Print answer
        cout << s << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool build(int t, int a, int b)
{
    string s = "";
    int c = 0;
    while(a && b)
    {
        s += ((t == 1)? "01" : "10");
        a--; b--;
        c++;
    }
    if(t == 1 && a) { s += "0"; a--; }      // May add extra 0
    if(t == 2 && b) { s += "1"; b--; c++; } // May add extra 1
    // At this point we only have space for "c" extra ones
    if(a || b > c)
        return false;
    // Print answer
    for(int i = 0; i < (int)s.size(); i++)
        if(s[i] == '1' && b)
        {
            cout << "11";
            b--;
        }
        else
            cout << s[i];
    cout << '\n';
    return true;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int a, b;
    while(cin >> a >> b)
        if(!build(1, a, b) && !build(2, a, b))
            cout << "-1" << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,last; // n: #0, m: #1
    string s;
    while(cin >> n >> m)
    {
        s = "";
        // Build strings "101"
        while(n > 0 && m > 1)
        {
            n--; m -= 2;
            s += "101";
        }
        // Fit the rest
        bool flag = false;
        // Append a "1"
        if(m) { m--; s += "1"; }
        // Append a "0". If we can, we could append two extra "1"
        if(n) { n--; s += "0"; flag = true; }
        if(m && flag) { m--; s += "1"; }
        if(m && flag) { m--; s += "1"; }
        // Append a "1" at the beggining
        if(m) { m--; s = "1" + s; }
        // If we have more characters, it is impossible
        if(n > 0 || m > 0)
            s = "-1";
        // Print answer
        cout << s << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m; // n: # of 0, m: # of 1
    bool flag;
    string s;
    while(cin >> n >> m)
    {
        s = "";
        while(n >= 1 && m >= 2)
        {
            s += "101";
            n--;
            m -= 2;
            flag = true;
        }

        while(n >= 1 && m >= 1)
        {
            s += "10";
            n--;
            m--;
            flag = false;
        }

        if(n == 0 && m == 0);
        else if(m == 1)
            s = "1" + s;
        else if(m == 2)
            s = "1" + s + "1";
        else if(m == 3 && !flag)
            s = "1" + s + "11";
        else if(n == 1)
            s = "0" + s;
        else if(n == 2 && flag)
            s = "0" + s + "0";
        else
            s = "-1";

        cout << s << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*2+2<m || n-1>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0,last;
    for_each(i,tot)
    {
        if(n-1==m)
        {
            //cout<<"last="<<last;
            flag=1;
        }
        if(!flag)
        {
            if(i%3==0 && m>0)
            {
                cout<<'1';
                m--;
                last=1;
            }
            else if(i%3==1 && m>0 )
            {

                cout<<'1';
                m--;
                last=2;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                    last=0;
                }
            }
        }
        else
        {
            break;
        }
    }
    for(int j=0;j<tot-i;j++)
    {
        if(j%2!=0)
        {
            cout<<'1';
            m--;
            last=1;
        }
        else
        {
            cout<<'0';
            n--;
            last=0;
        }
    }
    if(last==0)
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    else
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*4<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag;
    for_each(i,tot)
    {
        if(n==m)
        {
            flag=1;
        }
        if(!flag)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                }
            }
        }
    }
    for_each(i,m)
    {
        cout<<'1';
    }
    for_each(i,n)
    {
        cout<<'0';
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*4<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    for_each(i,tot)
    {
        if(n>m-1)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                }
            }
        }
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*2+2<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0,last;
    for_each(i,tot)
    {
        if(n==m)
        {
            flag=1;
        }
        if(!flag)
        {

            if(i%3==0 && m>0)
            {
                cout<<'1';
                m--;
                last=1;
            }
            else if(i%3==1 && m>0 )
            {

                cout<<'1';
                m--;
                last=2;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                    last=0;
                }
            }
        }
        else
        {
            if(last==2)
            {
                if(i%2==0)
                {
                    if(n>0)
                    {
                        cout<<'0';
                        n--;
                        last=0;
                    }
                }
                else
                {
                    if(m>0)
                    {
                        cout<<'1';
                        m--;
                        last=1;
                    }
                }
            }
            else
            {
                if(i%2==0)
                {
                    if(n>0)
                    {
                        cout<<'0';
                        n--;
                        last=0;
                    }
                }
                else
                {
                    if(m>0)
                    {
                        cout<<'1';
                        m--;
                        last=1;
                    }
                }
            }
        }
    }
    if(last==0)
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    else
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    if(n*4<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    for_each(i,n+m)
    {
        if(i%3==0 || i%3==1)
            cout<<'1';
        else
            cout<<'0';
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*4<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0;
    for_each(i,tot)
    {
        if(n==m)
        {
            flag=1;
        }
        if(!flag)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                }
            }
        }
    }
    for_each(i,m)
    {
        cout<<'1';
    }
    for_each(i,n)
    {
        cout<<'0';
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*4<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    for_each(i,tot)
    {
        if(n>m-1)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                }
            }
        }
    }
    for_each(i,m)
    {
        cout<<'1';
    }
    for_each(i,n)
    {
        cout<<'0';
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*2+2<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0,last;
    for_each(i,tot)
    {
        if(n==m)
        {
            //cout<<"last="<<last;
            flag=1;
        }
        if(!flag)
        {
            if(i%3==0 && m>0)
            {
                cout<<'1';
                m--;
                last=1;
            }
            else if(i%3==1 && m>0 )
            {

                cout<<'1';
                m--;
                last=2;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                    last=0;
                }
            }
        }
        else
        {
            break;
        }
    }
    for(int j=0;j<tot-i;j++)
    {
        if(j%2!=0)
        {
            cout<<'1';
            m--;
            last=1;
        }
        else
        {
            cout<<'0';
            n--;
            last=0;
        }
    }
    if(last==0)
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    else
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*2+2<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0,last;
    for_each(i,tot)
    {
        if(n==m)
        {
            flag=1;
        }
        if(!flag)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
                last=1;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                    last=0;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                    last=0;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                    last=1;
                }
            }
        }
    }
    if(last==0)
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    else
    {
        for_each(i,m)
        {
            cout<<'1';
        }
        for_each(i,n)
        {
            cout<<'0';
        }
    }
    cout<<endl;
    return 0;

}


#include <bits/stdc++.h>
#define MAX 1000
#define MOD 1000000007
#define for_each(i,n) for(i=0;i<n;++i)
#define for_each_dec(i,n) for(i=n-1;i>=0;--i)
#define SIZE(v) LL len=v.size();
typedef long long int LL;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<LL> vll;
typedef vector<vll> vvll;

//fucntion to display a vector
template <typename T>
void displayVector(T v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cout<<*i<<" ";
    }
    cout<<endl;
}

//function to display a matrix
template <typename T>
void displayMatrix(T mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            displayVector(*i);
    }
    cout<<endl;
}

//fucntion to input a vector
template <typename T>
void inputVector(T &v)
{
    for(typename T::iterator i=v.begin();i!=v.end();i++)
    {
        cin>>*i;
    }
}

//function to input a matrix
template <typename T>
void inputMatrix(T &mat)
{
    for(typename T::iterator i=mat.begin();i!=mat.end();i++)
    {
            inputVector(*i);
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.out","w",stdout);
    LL i,j,n,t,m,sum=0,ans=0,count=0;
    string str;
    vll arr;
    vvll mat;
    cin>>n>>m;
    LL tot=n+m;
    if(n*2+2<m || n>m)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    int flag=0;
    for_each(i,tot)
    {
        if(n==m)
        {
            flag=1;
        }
        if(!flag)
        {

            if(i%3==0 || i%3==1 && m>0)
            {
                cout<<'1';
                m--;
            }
            else
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
        }
        else
        {
            if(i%2==0)
            {
                if(n>0)
                {
                    cout<<'0';
                    n--;
                }
            }
            else
            {
                if(m>0)
                {
                    cout<<'1';
                    m--;
                }
            }
        }
    }
    for_each(i,m)
    {
        cout<<'1';
    }
    for_each(i,n)
    {
        cout<<'0';
    }
    cout<<endl;
    return 0;

}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			str.insert(str.size() , "1");
		}else if(numberone == 2){
			str.insert(str.size() ,"11");
		}
	}
  printf("%s \n" , str.c_str());
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	  printf("-1\n");
	   return 0;
   }

   // valid cases..
    string str = "";
	vector<pair<int  , string>> vstr;
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				vstr.push_back(make_pair(i , "1"));
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			vstr.push_back(make_pair(str.size(), "1"));
		}else if(numberone == 2){
			vstr.push_back(make_pair(str.size(), "11"));
		}
	}
	int x = 0;
	for(int i = 0; i <str.size() ;i++){
		if(i == vstr[x].first){
			printf("%s" ,vstr[x].second.c_str());
			x++;
		}else{
			printf("%c" , str[i]);
		}
	}

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
   int numberone , numberzero;
   cin>>numberzero>>numberone;
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
	cout<<str<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
   int numberone , numberzero;
   cin>>numberzero>>numberone;
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberzero + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(str.size() , "0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
	cout<<str<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	  printf("-1\n");
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			str.insert(str.size() , "1");
		}else if(numberone == 2){
			str.insert(str.size() ,"11");
		}
	}
  printf("%s \n" , str.c_str());
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
 cout<<str;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	  printf("-1\n");
	   return 0;
   }

   // valid cases..
    string str = "";
	vector<pair<int  , string> > vstr;
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				vstr.push_back(make_pair(i , "1"));
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			vstr.push_back(make_pair(str.size(), "1"));
		}else if(numberone == 2){
			vstr.push_back(make_pair(str.size(), "11"));
		}
	}
	int x = 0;
	for(int i = 0; i <str.size() ;i++){
		if(i == vstr[x].first){
			printf("%s" ,vstr[x].second.c_str());
			x++;
		}else{
			printf("%c" , str[i]);
		}
	}

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			str.insert(str.size() , "1");
		}else{
			str.insert(str.size() , "11");
		}
	}
 cout<<str;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	  printf("-1\n");
	   return 0;
   }

   // valid cases..
    string str = "";
	vector<pair<int  , string> > vstr;
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				vstr.push_back(make_pair(i , "1"));
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			vstr.push_back(make_pair(str.size(), "1"));
		}else if(numberone == 2){
			vstr.push_back(make_pair(str.size(), "11"));
		}
	}
	int x = 0;
	for(int i = 0; i <str.size() ;i++){
		if(x < vstr.size() && i == vstr[x].first){
			printf("%s" ,vstr[x].second.c_str());
			x++;
		}
			printf("%c" , str[i]);

	}
	if(x < vstr.size()){
		printf("%s" , vstr[str.size()].second.c_str());
	}

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
   int numberone , numberzero;
   cin>>numberzero>>numberone;
   int maxiones = (numberzero * 2) + ((numberzero - 1) *2 );
   int maxizero = (numberzero + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str +="0";
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
	cout<<str<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			str.insert(str.size() , "1");
		}else if(numberone == 2){
			str.insert(str.size() ,"11");
		}
	}
 cout<<str;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
char arr[100000000];
int main(){
	 ios_base::sync_with_stdio(0);
  cin.tie(0);
   int numberone , numberzero;

   scanf("%d" , &numberzero);
   scanf("%d", &numberone);
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberone + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	  printf("-1\n");
	   return 0;
   }

   // valid cases..
    string str = "";
	vector<pair<int  , string> > vstr;
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				vstr.push_back(make_pair(i , "1"));
				numberone--;
				i++;
			}
		}
		if(numberone == 1){
			vstr.push_back(make_pair(str.size(), "1"));
		}else if(numberone == 2){
			vstr.push_back(make_pair(str.size(), "11"));
		}
	}
	int x = 0;
	for(int i = 0; i <str.size() ;i++){
		if(x < vstr.size() && i == vstr[x].first){
			printf("%s" ,vstr[x].second.c_str());
			x++;
		}
			printf("%c" , str[i]);

	}
	if(x < vstr.size()){
		printf("%s" , vstr[x].second.c_str());
	}

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
   int numberone , numberzero;
   cin>>numberzero>>numberone;
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberzero + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str +="0";
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
	cout<<str<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
   int numberone , numberzero;
   cin>>numberzero>>numberone;
   int maxiones = (numberzero * 4) -((numberzero - 1) *2 );
   int maxizero = (numberzero + 1);

   // invaild cases..
   if(numberone > maxiones || numberzero > maxizero){
	   cout<<-1<<endl;
	   return 0;
   }

   // valid cases..
    string str = "";
	int mini  = min(numberone , numberzero);
	bool zeromax = false , onemax = false;
	mini == zeromax ? onemax = true : zeromax = true;
	for(int i = 0; i < mini ; i++){
		if(onemax){
			str += "01";
		}else{
			str += "10";
		}
	}
	numberone -= mini; numberzero -= mini;
	if(numberzero){
		str.insert(0,"0");
	}else{
		for(int i = 0; i < str.size();i++){
			if(!numberone) break;
			if(str[i] == '1'){
				str.insert(i , "1");
				numberone--;
				i++;
			}
		}
		while(numberone--){
			str.insert(str.size() , "1");
		}
	}
	cout<<str<<endl;
	return 0;
}


#include<bits/stdc++.h>
#include<math.h>
#include<limits>
#define ll long long
using namespace std;
int main()
{
	ll n,m;
	int flag=1;
	int a[3000001];
	for( int i=0; i<3000000; i++)
	{
		a[i]=2;
	}
	cin>>n>>m;
	for( int i=0; i<n; i++ )
		a[(3*i)+2] = 0;
	if(m<n-1 || m>(2*n)+2)
	{
		cout<<-1;
		flag =0;
	}
	else if(m == n-1|| m == n)
	{
		for( int i=0; i<m; i++)
			a[3*i] = 1;
	}
	else
	{
		for( int i=0; i<n+1; i++)
			a[3*i] = 1;
		m = m-n-1;
		for( int i=0; i<m; i++)
			a[(3*i)+1] = 1;
	}
	if(flag!=0)
	{
		for( int i=0; i<(3*n)+2; i++)
		{
			if(a[i]!=2)
				cout<<a[i];
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#include<math.h>
#include<limits>
#define ll long long
using namespace std;
int main()
{
	ll n,m;
	int flag=1;
	int a[3000004];
	for( int i=0; i<3000003; i++)
	{
		a[i]=2;
	}
	cin>>n>>m;
	for( int i=0; i<n; i++ )
		a[(3*i)+2] = 0;
	if(m<n-1 || m>(2*n)+2)
	{
		cout<<-1;
		flag =0;
	}
	else if(m == n-1|| m == n)
	{
		for( int i=0; i<m; i++)
			a[3*i] = 1;
	}
	else
	{
		for( int i=0; i<n+1; i++)
			a[3*i] = 1;
		m = m-n-1;
		for( int i=0; i<m; i++)
			a[(3*i)+1] = 1;
	}
	if(flag!=0)
	{
		for( int i=0; i<(3*n)+2; i++)
		{
			if(a[i]!=2)
				cout<<a[i];
		}
	}
	return 0;
}