H,W = map(int,input().split())
A = []

for i in range(H):
    t = list(input())
    A.append(t)

print(A)

move = [[-1,0],[1,0],[0,-1],[0,1]]
for i in range(H):
    for j in range(W):
        dp = [[float('inf') for i in range(W)] for j in range(H)]
        if A[i][j] == '.':
            for p,q in zip(move):
                if