//read medaka box

#include <bits/stdc++.h>

typedef unsigned long long __uint64;

using namespace std;

bool paran(__int64 a)
{
    return (a + 1) % 2 == 0;
}

__int64 checksum(const vector<vector<__int64>> &v, __int64 i, __int64 j)
{
    if(i == 0) return 1;
    return v[i - 1][j];
}

void solve(const vector<vector<bool>> &v, vector<vector<__int64>> &vodopad, __int64 m, __int64 n)
{
    __int64 i = 0, j = 0;

    while(i < m)
    {
        j = 0;
        while(j < n)
        {
            bool wr_once = false;

            if(v[i][j])
            {
                //cout << "upisano " << i << " " << j << '\n';
                vodopad[i][j] += checksum(vodopad, i, j);
                wr_once = true;
            }

            if(!v[i][j])
            {
                if(j == 0)
                {
                    __int64 tmp = 0;
                    while(!v[i][j])
                    {
                        tmp += checksum(vodopad, i, j);
                        j++;
                    }
                    vodopad[i][j] += tmp;
                }
                else
                {
                    __int64 pind = j - 1;
                    __int64 tmp = 0;
                    while(!v[i][j] && j < n)
                    {
                        tmp += checksum(vodopad, i, j);
                        j++;
                        //cout << "dobar momenat " << j << '\n';
                    }

                    if(j == n)
                    {
                        //cout << "upisano stena " << i << " " << pind << '\n';
                        vodopad[i][pind] += tmp;
                    }
                    else
                    {
                        //cout << "upisano stena dobar " << i << " " << j << " " << pind << '\n';
                        vodopad[i][pind] += (tmp / 2) + ((tmp % 2 == 0) ? 0 : !paran(i));
                        vodopad[i][j] += (tmp / 2) + ((tmp % 2 == 0) ? 0 : paran(i));
                    }
                }
            }
            if(v[i][j] && !wr_once)
            {
                //cout << "upisano " << i << " " << j << '\n';
                vodopad[i][j] += checksum(vodopad, i, j);
            }
            j++;
        }
        i++;
    }

    /*
    cout << '\n';

    for(int ii = 0; ii < m - 1; ii++) {
        for(int jj = 0; jj < n; jj++)
            cout << vodopad[ii][jj] << " ";
        cout << '\n';
    }
    */

    for(int k = 0; k < n; k++)
    {
        if(k < n - 1)
            cout << vodopad[m - 1][k] << " ";
        else
            cout << vodopad[m - 1][k];
    }

    cout << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);

    __int64 m, n;
    cin >> m >> n;

    vector<vector<bool>> v(m, vector<bool>(n, false));
    vector<vector<__int64>> vodopad(m, vector<__int64>(n, 0));

    for(int i = 0; i < m; i++)
    {
        for(int j = 0; j < n; j++)
        {
            int a; cin >> a;
            v[i][j] = a;
        }
    }

    solve(v, vodopad, m, n);

    cout.flush();
    return 0;
}