Dr. Alice, a myrmecologist, was studying the traveling pattern of ants in ant colonies. She represented an ant colony in the form of a rectangular array of size N∗M. Each cell of this rectangular array is either 0 or 1. 0 represents that an ant is present in the cell and 1 represents that sugar is present in the cell. A cell in ith row and jth column is represented by (i,j). In the study, Dr. Alice made an interesting observation: each ant tries to go the sugar cell that is nearest to it. She wants to determine the nearest distance to a sugar cell for each cell.
Here the distance between two cells a(ai,aj) and b(bi,bj) is defined as:
Dist(a,b)=|ai−bi|+|aj−bj|
It is given that at least one cell contains sugar.
Input
The first line contains 2 space-separated Integers N and M denoting the number of rows and columns respectively.
Then N lines follows. Each contains M space-separated values (either 1 or 0).
Output
The output should be a 2-D matrix of N rows and M columns.In the ith line , 1≤i≤N, there should be written M integers d(i,j) separated by single spaces, where d(i,j) is the distance from the cell (i,j) to the nearest sugar cell.
Constraints