using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int d, h;
            h = int.Parse(s[0]);
            d = int.Parse(s[1]);
            int[,] n = new int[h, d];
            int i, j;
            string[] str;
            for (i = 0; i < h; i++)
            {
                str = Console.ReadLine().Split();
                int w = str.Length;
                for (j = 0; j < d; j++)
                {
                    n[i, j] = int.Parse(str[j]);
                }
            }
            int l, x;
            int t = d;
            for (i = 0; i < h; i++)
            {
                l = 0; d = 0;
                for (j = 0; j < t; j++)
                {
                    if (i == 0) x = 1;
                    else
                        x = n[i - 1, j];
                    if (n[i, j] == 0)
                    {
                        if ((i + 1) % 2 != 0)
                        {
                            l = x / 2 + 1;
                            d = x - l;
                            if (j == 0) n[i, j + 1] = n[i, j + 1] + d;
                            else if (j == t - 1)
                            {
                                n[i, j - 1] = n[i, j - 1] + l;
                            }
                            else
                            {
                                n[i, j - 1] = n[i, j - 1] + l;
                                n[i, j + 1] = n[i, j + 1] + d;
                            }
                        }
                        else
                        {
                            d = x / 2 + 1;
                            l = x - l;
                            if (j == 0)
                                n[i, j + 1] = n[i, j + 1] + d;
                            else if (j == t - 1)
                            {
                                n[i, j - 1] = n[i, j - 1] + l;
                            }
                            else
                            {
                                n[i, j - 1] = n[i, j - 1] + l;
                                n[i, j + 1] = n[i, j + 1] + d;
                            }
                        }
                    }
                }
            }
            string e = "";
            for (j = 0; j < t; j++) e =e + n[h - 1, j].ToString() + " ";
            Console.WriteLine(e);
        }
    }
}