#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    long n,m;
    scanf("%ld%ld",&n,&m);
    long **p=new long*[n+1];
    long **a=new long*[n+1];
    p[0]=new long[m];
    for (long i=1;i<=n;i++)
    {
        a[i]=new long[m];
        p[i]=(long*)calloc(m,sizeof(long));
        for (long j=0;j<m;j++)
        {
            scanf("%ld",&a[i][j]);
        }
    }
    for (long i=0;i<m;i++)
        p[0][i]=1;
    for (long i=1;i<=n;i++)
    {
        long k=0,sum=0,l=-1,r;
        for (long j=0;j<m;j++)
        {
            if (a[i][j]==1)
            {
                p[i][j]+=p[i-1][j];
                if (k==0) l=j;
                if (k==1)
                {
                    r=j;
                    k=0;
                    if (l==-1)
                    {
                        p[i][r]+=sum;
                    }
                    else
                    {
                        long pr=sum/2;
                        p[i][l]+=pr;
                        p[i][r]+=pr;
                        if (sum%2==1)
                        {
                            if (i%2==1) p[i][l]++; else p[i][r]++;
                        }
                    }
                    sum=0;
                    l=j;
                }
            }
            else
            if (a[i][j]==0)
            {
                k=1;
                sum+=p[i-1][j];
            }
        }
        if (k==1)
        {
            p[i][l]+=sum;
        }
    }
    for (long i=0;i<m;i++)
    {
        printf("%ld ",p[n][i]);
    }
    delete[] a,p;
    return 0;
}