Олимпиадный тренинг

Задача 23368. Organization of the conference (C, B')


Задача

Темы:
Recently, on a sunny spring day, the director of the Summer Flatland Computer School (LFCS) Sergey Aleksandrovich came up with the idea to organize the first Flatland programming conference for schoolchildren. Now he is faced with the task of choosing a venue. 

Flatland is a rectangle with m rows and n columns, each of whose cells contains one city? Sergey Alexandrovich has already counted the number of people wishing to take part in the conference for each city. It is known that Flatlanders do not like to travel far, so in whatever city it is held,  only schoolchildren from the city itself and neighboring cities will be able to take part in the conference. Formally speaking, if the conference is held in the city located in the i-th row and j-th column, then students from the cities (i, j), (i − 1, j) will participate in this conference (provided that i > 1) ,  (i + 1, j) (assuming i < m), (i, j − 1) (assuming j > 1) , and (i, j + 1) , (assuming j < n).
Now Sergey Alexandrovich wants to understand  in which cities it is possible to accommodate all visiting participants.  While he is figuring out the number of available places in Flatland hotels, you will have to calculate for each of the possible host cities how many students will need to provide accommodation for the duration of the conference.
Please note that students living in the same city where the conference is held do not need accommodation.

Input data format
The first line contains two numbers m and n (1 <= m, n <= 350) - the dimensions of Flatland. Each of the next m lines contains n numbers.
The i-th row and the j-th column contain the number ai,j ( 0<=  ai,j  <=10000)   ;-  number of schoolchildren from the city (i, j),  who want to take part in the conference.
Output format
Print m lines with n numbers each. The number in line number i and column number j should be equal to the number of visiting conference participants if the venue is
selected city, with coordinates (i, j).

Enter Output
34
1 0 3 2
5 6 1 2
1 1 0 11
5 10 3 5
8 7 11 14
6 7 13 2
1 1
5
0