using System;

namespace Vodopad
{
    class Program
    {
        static void Unos(ref int[,] a, int n, int m)
        {
            for (int i = 0; i < n; i++)
            {
                var cin = Console.ReadLine().Split(' ');
                for (int j = 0; j < m; j++)
                {
                    a[i, j] = int.Parse(cin[j]);
                }
            }
        }

        static void Stampaj(int[,] a, int n, int m)
        {
            for (int j = 0; j < m; j++)
            {
                Console.Write("{0} ", a[n - 1, j]);
            }
        }

        static int SD(int[,] v, int m, int i, int j)
        {
            while (v[i, j] == 0 && j <= m)
            {
                j++;
            }

            return j;
        }
        
        static int SL(int[,] v, int m, int i, int j)
        {
            while (v[i, j] == 0 && j >= 0)
            {
                j--;
            }

            return j;
        }
        
        static void Main(string[] args)
        {
            var cin = Console.ReadLine().Split(' ');
            var n = int.Parse(cin[0]);
            var m = int.Parse(cin[1]);

            var v = new int[n, m];
            Unos(ref v, n, m);

            var a = new int[n, m];

            for (int j = 0; j < m; j++)
            {
                if (v[0, j] == 0)
                {
                    a[0, (j > 0 ? j - 1 : j + 1)]++;
                }
                else
                {
                    a[0, j] += 1;
                }
            }

            for (int i = 1; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    if (v[i, j] == 0)
                    {
                        if (j == m - 1)
                        {
                            a[i, j - 1] += a[i - 1, j];
                        }
                        else if (j == 0)
                        {
                            a[i, j + 1] += a[i - 1, j];
                        }
                        else
                        {
                            var t = a[i - 1, j] / 2;
                            var o = a[i - 1, j] % 2;
                            var p = i % 2 == 0;
                            var l = SL(v, m, i, j);
                            var d = SD(v, m, i, j);
                            l = (l == -1 ? d : l);
                            d = (d == m ? l : d);
                            a[i, l] += t + (p ? o : 0);
                            a[i, d] += t + (p ? 0 : o);
                        }
                    }
                    else
                    {
                        a[i, j] += a[i - 1, j];
                    }
                }
            }
            
            Stampaj(a, n, m);
        }
    }
}