#include <iostream>

using namespace std;

bool xdpiski[1000000];
int protok[1000000];
int protokpomoc[1000000];

int main()
{
	int h, n; cin >> h >> n;
	for (int i = 0; i < n; i++) protok[i] = 1;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < n; j++) cin >> xdpiski[j];
		if (xdpiski[0] == 1) protokpomoc[0] += protok[0];
		else { protokpomoc[1] += protok[0]; protokpomoc[0] = 0; }
		if (xdpiski[n-1] == 1) protokpomoc[n-1] += protok[n-1];
		else { protokpomoc[n - 2] += protok[n - 1]; protokpomoc[n - 1] = 0; }	
		for (int j = 1; j < n - 1; j++)
		{
			if (xdpiski[j] == 1) protokpomoc[j] += protok[j];
			else
			{
				protokpomoc[j] = 0;
				protokpomoc[j - 1] += protok[j]/2;
				protokpomoc[j + 1] += protok[j]/2;
				if (protok[j] % 2 == 1)
				{
					if (i % 2 == 1) protokpomoc[j + 1] += 1;
					else protokpomoc[j - 1] += 1;
				}
			}
		}
		for (int j = 0; j < n; j++) protok[j] = protokpomoc[j];
		for (int j = 0; j < n; j++) protokpomoc[j] = 0;
	}
	for (int i = 0; i < n; i++) cout << protok[i] << " ";
	cout << endl;
	//system("pause");
    return 0;
}