# your code goes here #hole def ab(a1): if a1<0: a1*=-1 return a1 W,H=(int(i) for i in input().split()) C=[input() for i in range(H)] D=[] for i in range(H): D.append([]) for j in range(W): D[i].append(0) a=[] for i in range(H): a.append([]) for j in range(W): a[i].append(0) h=[[],[]] #print(C) for l in range(2): Nd=0 i=0 if l==1: i=h[0][0][0] while i=0 and vh=0 and vw