#include <iostream>
using namespace std;

int main()
{
    long h;
    long n;
    long l;
    long z;

    int p;
    int f;

    long tp[1000000];

    cin >> h;
    cin >> n;

    for(long i; i < h; i++)
    {
        tp[i] = 1;
    }

    for(long v; v < h; v++)
    {
        z = 0;
        f = 0;
        for(long k; k < n; k++)
        {
            cin >> p;
            if (p == 0)
            {
                if(f == 0)
                {
                    l = k;
                }
                z += tp[k];
                f = 1;
            }
            else
            {
                if(f == 1)
                {
                   tp[l-1] += (z/2);
                   tp[k] += (z/2);
                   if(z%2 > 0)
                   {
                        tp[l-1] += z%2;
                        tp[k] += (z+1)%2;
                   }
                   f = 0; 
                   z = 0;
                }
            }
        }
    }

    for(long i; i < h; i++)
    {
        cout << tp[i];
    }


	return 0;
}