#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n, m;
    cin >> n >> m;

    int a[n + 1][m + 1], b[n + 1][m + 1];
    memset(a, 0, sizeof a);
    memset(b, 0, sizeof b);

    for (int i = 1; i <= m; ++i)
        b[0][i] = a[0][i] = 1;

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

    for (int i = 1; i <= n; ++i){
        vi l, r;

        for (int j = 1; j <= m; ++j){
            if (a[i][j] == 0) continue;

            if (j < m && a[i][j + 1] == 0)
                l.push_back(-1 * j);

            if (j > 1 && a[i][j - 1] == 0)
                r.push_back(j);
        }

        reverse(l.begin(), l.end());
        l.push_back(10); //kao Messi :D
        r.push_back(INT32_MAX);

        for (int j = 1; j <= m; ++j){
            if (a[i][j] == 1){
                b[i][j] += b[i - 1][j];
            } else {
                int indr = *upper_bound(r.begin(), r.end(), j);
                int indl = *upper_bound(l.begin(), l.end(), -1 * j);

                if (indl == 10){
                    b[i][indr] += b[i - 1][j];
                    continue;
                }

                indl *= -1;

                if (indr == INT32_MAX){
                    b[i][indl] += b[i - 1][j];
                    continue;
                }

                if (i % 2 == 1){
                    b[i][indl] += (b[i - 1][j] + 1) / 2;
                    b[i][indr] += (b[i - 1][j]) / 2;
                } else {
                    b[i][indr] += (b[i - 1][j] + 1) / 2;
                    b[i][indl] += (b[i - 1][j]) / 2;
                }
            }
        }
    }

    for (int j = 1; j <= m; ++j)
        cout << b[n][j] << ' ';
    cout << '\n';
}