#include<iostream>
int h, r;
int index(int x, int y){
    return x * r + y;
}
int m[1000005], tok[1000000 + 5];
int main(){

    std::cin >> h >> r;
    for(int i = 1; i <= h; i++)
        for(int j = 1; j <= r; j++){
            std::cin >> m[index(i, j)];
        }
    for(int i = 1; i <= r; i++)
        tok[index(0, i)] = 1;


    for(int i = 1; i <= h; i++){
        int zbirVoda = 0;
        int zbirKoji = 0;
        for(int j = 1; j <= r; j++){
            //std::cout << "i, j = " << i << " " << j << " zbirKoji = " << zbirKoji << " zbirVoda = " << zbirVoda;
            if(m[index(i, j)] == 0){
                //std::cout << " A";
                zbirKoji++;
                zbirVoda += tok[index(i - 1, j)];
            }
            if(m[index(i, j)] == 1 or j == r){
                if(m[index(i, j)] == 1)
                    tok[index(i, j)] = tok[index(i - 1, j)];
               // std::cout << " B";
                if(j == r and m[index(i, j)] == 0)
                    tok[index(i, j - zbirKoji)] += zbirVoda;
                else if(j - zbirKoji != 1){
                   // std::cout << " C";
                    tok[index(i, j)] += zbirVoda / 2  + zbirVoda % 2 * (i % 2 == 0);
                    tok[index(i, j - zbirKoji - 1)] +=  zbirVoda / 2  + zbirVoda % 2 * (i % 2 == 1);
                }
                else if(j - zbirKoji == 1){
                    tok[index(i, j)] +=  zbirVoda;
                    //std::cout << " D tok = " << tok[3][2];

                }
                zbirKoji = zbirVoda = 0;
            }
            //std::cout << "\n";
        }
    }

   // std::cout << "\n\n";
    //for(int i = 1; i <= h; i++){
        for(int j = 1; j <= r; j++)
            std::cout << tok[index(h, j)] << " ";
       // std::cout << std::endl;
    //}

    return 0;
}