package net.pinger.takmicenje;

import java.util.*;

public class Takmicenje {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int width = scanner.nextInt();
        int height = scanner.nextInt();

        int[][] mat = new int[10000][10000];
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                mat[i][j] = scanner.nextInt();
            }
        }

        getLast(width, height, mat);
    }


    public static void getLast(int width, int height, int[][] array) {
        int[] arr = new int[height];

        // Menjamo sa jedinicama
        for (int i = 0; i < height; i++) {
            arr[i] = 1;
        }

        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                int nova = array[i][j];

                if (nova == 0) {
                    // Ako je prvi ili ako zadnji
                    if (j == 0) {

                        arr[j + 1] += arr[j];
                        arr[j] = 0;


                    } else if (j == height - 1) {

                        arr[j - 1] += arr[j];
                        arr[j] = 0;

                    } else {
                        while (arr[j] > 0) {
                            if (arr[j] % 2 == 0) {
                                arr[j + 1] += arr[j] / 2;
                                arr[j - 1] += arr[j] / 2;
                                arr[j] = 0;
                            } else {
                                int ostatak = arr[j] % 2;
                                arr[j + 1] += (arr[j] - ostatak) / 2;
                                arr[j - 1] += (arr[j] - ostatak) / 2;
                                arr[j] = 0;

                                if (i % 2 == 0) {
                                    arr[j + 1] += 1;
                                    arr[j] -= 1;
                                } else {
                                    arr[j - 1] += 1;
                                    arr[j] -= 1;
                                }
                            }
                        }
                    }
                }
            }
        }

        for (int i = 0; i < width; i++) {
            System.out.println(arr[i]);
        }


    }

    public static void printOut(int[] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
    }








}