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

namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            int h = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());
            int [,]a=new int [n,h];
            int[,] b = new int[n,h];
            for (int i = 0; i < h; i++)
                for (int j = 0; j < n; j++)
                    a[i,j] = int.Parse(Console.ReadLine());
            for (int i = 0; i < h; i++)
                for (int j = 0; j < n; j++)
                    b[i, j] = a[i, j];
            for (int i = 0; i < h-1; i++)
                for (int j = 0; j < n; j++)
                {
                    if (a[i, j] != 0 )
                        b[i + 1, j] += 1;
                    else
                        if(j==0 )
                            b[i + 1, j+1] += a[i,0];
                        else if (j == n - 1)
                            b[i + 1, j - 1] += a[i,n-1];
                        else
                        {
                            if (a[i, j] % 2 != 0)
                            {
                                b[i + 1, j + 1] += a[i, j] / 2;
                                b[i + 1, j - 1] += a[i, j] / 2;
                            }
                            else
                                if (i % 2 == 0)
                                {
                                    b[i + 1, j + 1] += a[i, j] / 2 + 1;
                                    b[i + 1, j - 1] += a[i, j] / 2;
                                }
                                else
                                {
                                    b[i + 1, j + 1] += a[i, j] / 2;
                                    b[i + 1, j - 1] += a[i, j] / 2+1;
                                }
                        }
                }
            if (a[h - 1, 0] == 0)
            {
                b[h - 1, 1] += a[h - 1, 0];
                b[h - 1, 0] = 0;
            }
            if (a[h - 1, n - 1] == 0)
            {
                b[h - 1, n - 2] += a[h - 1, n - 1];
                b[h - 1, n - 1] = 0;
            }


            
            for (int j = 0; j < n; j++)
                Console.Write(b[h - 1, j] + " ");
            
            Console.ReadLine();
        }
    }
}