#include <iostream>


using namespace std;

int main()
{
    int x,y;
    int brojac=1;

    cin>>x;
    cin>>y;
    int niz[x][y];
    int noviniz[x][y];


    for(int i=0;i<x;i++)
    {
        for(int j=0;j<y;j++)
        {
            cin>>niz[i][j];
            noviniz[i][j]=niz[i][j];
        }
    }


    for(int i=0;i<x;i++)
    {

        for(int j=0;j<y;j++)
        {

            if(niz[i][j]==0)
            {
                for(int k=j+1;k<y;k++)
                {
                    if(niz[i][k]==0)
                    {
                        brojac++;
                    }
                    else
                    {
                        
                        noviniz[i][k+1]+=brojac/2;
                        noviniz[i][j]+=brojac/2;
                        brojac=1;
                        break;
                    }
                }

                if(j==0 && niz[i][j]==0)
                {
                   noviniz[i][j+1]+=1;

                }
                else if(j==x-1 && niz[i][j]==0)
                {
                   noviniz[i][j-1]+=1;

                }
                else
                {
                    if(j%2==0)
                    {
                        noviniz[i][j+1]+=1;
                    }
                    else
                    {
                       noviniz[i][j-1]+=1;
                    }
                }

            }
        }

    }
    cout<<endl;
    for(int k=0;k<y;k++)
    {
        cout<<noviniz[x-1][k]<<" ";
    }


}