#include <iostream>
#include <vector>
using namespace std;

struct stena {
	int x1, x2, protok;
};

int main() {
	int h, n;
	
	cin >> h >> n;
	
	vector<int> red(n, 0);
	vector<vector<int> > M(h, red), protoci(h + 1, red);
	protoci[0] = vector<int>(n, 1);
	
	for (int i = 0; i < h; i++) for (int j = 0; j < n; j++) cin >>M[i][j];
	
	vector<stena> stene;
	
	for (int i = 0; i < h; i++) {
		
		
		stene.clear();
		
		bool imastena = false;
		stena s;
		
		for (int j = 0; j < n; j++) {
			if (M[i][j] == 0) {
				protoci[i + 1][j] = 0;
				
				// na tom mestu ima stena
				
				if (imastena) {
					s.x2 = j;
					s.protok += protoci[i][j];
				} else {
					// prvi put vidimo stenu
					s.x1 = j;
					s.x2 = j;
					s.protok = protoci[i][j];
					imastena = true;
				}	
				
			} else {
				protoci[i + 1][j] = protoci[i][j];
				if (imastena) {
					stene.push_back(s);
					imastena = false;
				}	
				
				
			}
		}
		
		if (imastena) {
			stene.push_back(s);
			imastena = false;
		}
		
		
		
		for (int k = 0; k < stene.size(); k++) {
			stena s = stene[k];
			
			if (s.x1 == 0) protoci[i + 1][s.x2 + 1] += s.protok; 
			else if (s.x2 == n - 1) protoci[i + 1][s.x1 - 1] += s.protok;
			else {
				if (s.protok % 2 == 0) {
					protoci[i + 1][s.x2 + 1] += s.protok / 2; 
					protoci[i + 1][s.x1 - 1] += s.protok / 2;
				} else if (i % 2 == 0) {
					protoci[i + 1][s.x2 + 1] += s.protok / 2; 
					protoci[i + 1][s.x1 - 1] += s.protok / 2 + 1;
					
				} else {
					
					protoci[i + 1][s.x2 + 1] += s.protok / 2 + 1; 
					protoci[i + 1][s.x1 - 1] += s.protok / 2;
					
				}
			}		
		}
		
	}
	
	for (int j = 0; j < n; j++) cout << protoci[h][j] << " ";
	cout << endl;	
	
	return 0;
}