#include <cstdio>
#include <bits/stdc++.h>

using namespace std;

int a[10001][10001];
int protok[10001][10001];

void prelaz(int h,int n){
    for (int i=0;i<n;i++){
        if (a[h][i] && protok[h][i])
            protok[h+1][i]+=protok[h][i];
        if (a[h][i]==0 && protok[h][i]){
            if (i==0){
                protok[h+1][i+1]+=protok[h][i];
            } else
            if (i==n-1){
                protok[h+1][i-1]+=protok[h][i];
            } else
            if (protok[h][i]%2==0){
                protok[h+1][i-1]+=(protok[h][i]/2);
                protok[h+1][i+1]+=(protok[h][i]/2);
            } else
            if (h%2==1){
                protok[h+1][i+1]+=((protok[h][i]-1)/2+1);
                protok[h+1][i-1]+=((protok[h][i]-1)/2);
            } else {
                protok[h+1][i-1]+=((protok[h][i]-1)/2+1);
                protok[h+1][i+1]+=((protok[h][i]-1)/2);
            }
        }
    }
}

int main()
{
    int h,n;
    scanf("%d %d",&h,&n);
    for (int i=0;i<h;i++)
    for (int j=0;j<n;j++){
        scanf("%d",&a[i][j]);
    }
    for (int j=0;j<n;j++)
        protok[0][j]=1;
    for (int i=0;i<h;i++)
     prelaz(i,n);
    for (int k=0;k<n;k++){
        printf("%d ",protok[h][k]);
    }
    printf("\n");
    return 0;
}