#include <iostream>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
#include <cmath>

using namespace std;

typedef numeric_limits<streamsize> ignore_t;

int main()
{
	int h{}; //visina vodopada
	int n{}; //sirina vodopada;

	scanf_s("%d %d", &h, &n);

	int **vodopad = new int*[h + 1];
	int **protok  = new int*[h + 1];

	protok[0] = new int[n + 1];
	for (int i{ 1 }; i <= n; ++i)
		protok[0][i] = 1;

	for (int i{1}; i <= h; ++i) 
	{
		vodopad[i] = new int[n + 1];
		protok[i]  = new int[n + 1];
		for (int j{1}; j <= n; ++j) 
		{
			protok[i][j] = 0;
			cin >> vodopad[i][j];
			
		}
		cin.ignore(ignore_t::max(), '\n');
	}

	for (int i{1}; i <= h; ++i) 
	{
		for (int j{1}; j <= n; ++j) 
		{
			int temp{};
			switch (vodopad[i][j]) 
			{
			case 1:
			{
				protok[i][j] += protok[i - 1][j];
				break;
			}
			case 0:
			{
				if (!(j - 1)) 
				{
					protok[i][j + 1] += protok[i - 1][j];
				}
				else if (j + 1 > n) 
				{
					protok[i][j - 1] += protok[i - 1][j];
				}
				else 
				{
					if (protok[i][j]) 
					{
						temp = protok[i][j];
						protok[i][j] = 0;
					}
					if ((protok[i - 1][j] + temp) % 2 == 0) 
					{
						protok[i][j - 1] += (protok[i - 1][j] + temp) / 2;
						protok[i][j + 1] += (protok[i - 1][j] + temp) / 2 ;
					}
					else if ((protok[i - 1][j] + temp) % 2 == 1) 
					{
						protok[i][j - 1] += (protok[i - 1][j] + temp) / 2 ;
						protok[i][j + 1] += (protok[i - 1][j] + temp) / 2 ;

						if (i % 2 == 0) 
						{
							protok[i][j + 1] += (protok[i - 1][j] + temp) % 2;
						}
						if (i % 2 == 1) 
						{
							protok[i][j - 1] += (protok[i - 1][j] + temp) % 2;
						}
					}
					break;
				}
			}
			}
		}
	}

	for (int j{ 1 }; j <= n; ++j)
	{
		cout << protok[h][j] << ' ';
	}

	cin.clear();
	cin.ignore(ignore_t::max(), '\n');
	cin.get();

	return 0;
}