# your code goes here #rabirynce def ab(a1): if a1<0: a1*=-1 return a1 h,w=(int(i) for i in input().split()) sx,sy,gx,gy=(int(i) for i in input().split()) sx-=1 sy-=1 gx-=1 gy-=1 b=[list(input()) for i in range(h)] for i in range(h): for j in range(w): b[i][j]=int(b[i][j]) vn=[[sx,sy]] v=[[0,0]] Nd=0 i=0 a=[] for i in range(h): a.append([]) for j in range(w): a[i].append(0) a[sx][sy]=1 while Nd<1 and vn!=[] and i=0 and ux=0 and uyb[ux][uy]: k1=k*2 u1x=tx+k1 l1=l*2 u1y=ty+l1 if u1x>=0 and u1x=0 and u1y