import sys class dijkstra: def __init__(self,V): self.INF=float("inf") self.G=[[] for _ in [0]*V] self.V=V return def add1(self,s,t,v): self.G[s].append([t,v]) return def add2(self,s,t,v): self.G[s].append([t,v]) self.G[t].append([s,v]) return def run(self,s): from heapq import heapify,heappop,heappush ret=[self.INF]*self.V que=[] heapify(que) ret[s]=0 heappush(que,(0,s)) while que: p=heappop(que) v=p[1] if ret[v]ret[v]+e[1]: ret[e[0]]=ret[v]+e[1] heappush(que,(ret[e[0]],e[0])) return ret def main(): H,W=map(int,input().split()) assert(2<=H<=100) assert(2<=W<=100) U,D,R,L,K,P=map(int,input().split()) assert(0<=U<=100) assert(0<=D<=100) assert(0<=R<=100) assert(0<=L<=100) assert(0<=K<=10**13) assert(0<=P<=10**9) xs,ys,xt,yt=map(int,input().split()) assert(1<=xs<=H) assert(1<=ys<=W) assert(1<=xt<=H) assert(1<=yt<=W) assert((xs,ys)!=(xt,yt)) xs-=1 ys-=1 xt-=1 yt-=1 C=[] for i in range(H): S=input()+"#" for j in S: assert(j in[".","@","#"]) C.append(S) C.append("#"*W) assert(C[xs][ys]==".") assert(C[xt][yt]==".") ijk=dijkstra(H*W) U*=2 D*=2 R*=2 L*=2 K*=2 for i in range(H): for j in range(W): if C[i][j]=="#": continue if C[i][j]=="@": if C[i+1][j]==".": ijk.add1(W*i+j,W*(i+1)+j,P+D) ijk.add1(W*(i+1)+j,W*i+j,P+U) elif C[i+1][j]=="@": ijk.add1(W*i+j,W*(i+1)+j,P+D) ijk.add1(W*(i+1)+j,W*i+j,P+U) if C[i][j+1]==".": ijk.add1(W*i+j,W*i+j+1,P+R) ijk.add1(W*i+j+1,W*i+j,P+L) elif C[i][j+1]=="@": ijk.add1(W*i+j,W*i+j+1,2*P+R) ijk.add1(W*i+j+1,W*i+j,2*P+L) else: if C[i+1][j]==".": ijk.add1(W*i+j,W*(i+1)+j,D) ijk.add1(W*(i+1)+j,W*i+j,U) elif C[i+1][j]=="@": ijk.add1(W*i+j,W*(i+1)+j,P+D) ijk.add1(W*(i+1)+j,W*i+j,P+U) if C[i][j+1]==".": ijk.add1(W*i+j,W*i+j+1,R) ijk.add1(W*i+j+1,W*i+j,L) elif C[i][j+1]=="@": ijk.add1(W*i+j,W*i+j+1,P+R) ijk.add1(W*i+j+1,W*i+j,P+L) d=ijk.run(W*xs+ys) if d[W*xt+yt]<=K: print("Yes") else: print("No") sys.stderr.write(f"ans:{d[W*xt+yt]//2}\n") return main()