You are given a rectangular bitmap of size n×m. Each pixel of the bitmap is either white or black, and at least one pixel is white. The pixel in row i and column j is denoted (i,j).
The distance between two pixels p1=(i1,j1) and p2=(i2,j2) is defined as
d(p1,p2)=∣i1−i2∣+∣j1−j2∣.
Write a program that, for every pixel, computes the distance to the nearest white pixel.
The first line contains two integers n and m separated by a single space (1≤n≤182, 1≤m≤182).
Each of the following n lines contains one string of length m made of the characters 0 and 1, describing one row of the bitmap. In the string that describes row i of the bitmap, the j-th character is 1 if and only if the pixel (i,j) is white (1≤i≤n, 1≤j≤m).
Print n lines. The i-th line must contain m integers f(i,1),…,f(i,m) separated by single spaces, where f(i,j) is the distance from the pixel (i,j) to the nearest white pixel.