import sys,heapq sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) class Dijkstra_list(): # 1-based def __init__(self,N): self.N = N self.edges = [[] for _ in range(N+1)] def add(self,u,v,d,directed=False): if directed is False: # 無向グラフの場合 self.edges[u].append((v,d)) self.edges[v].append((u,d)) else: # 有向グラフの場合 self.edges[u].append((v,d)) def delete(self,u,v): self.edges[u] = [_ for _ in self.edges[u] if _[0] != v] self.edges[v] = [_ for _ in self.edges[v] if _[0] != u] def search(self,s): # sから各頂点までの最短距離 inf = 10**18 dist = [inf]*(self.N+1) # prev = [-1]*(self.N+1) dist[s] = 0 q = [] heapq.heappush(q,(0,s)) flag = [0]*(self.N+1) while q: d,u = heapq.heappop(q) if flag[u]: continue flag[u] = 1 for v,dd in self.edges[u]: if flag[v]: continue new_d = d + dd if dist[v] > new_d: dist[v] = new_d heapq.heappush(q,(new_d,v)) # prev[v] = u return dist # return dist,prev H,W = MI() U,D,R,L,K,P = MI() xs,ys,xt,yt = MI() C = ['#'*(W+1)] for _ in range(H): C.append('#'+S()) Di = Dijkstra_list((H+1)*(W+1)) directions = [(-1,0,U),(1,0,D),(0,-1,L),(0,1,R)] for i in range(1,H+1): for j in range(1,W+1): k = (W+1)*i+j for di,dj,cost in directions: ni,nj = i+di,j+dj if not (1 <= ni <= H and 1 <= nj <= W): continue if C[ni][nj] == '#': continue n = (W+1)*ni+nj if C[ni][nj] == '.': Di.add(k,n,cost,directed=True) else: Di.add(k,n,cost+P,directed=True) d = Di.search((W+1)*xs+ys)[(W+1)*xt+yt] if d <= K: print('Yes') else: print('No')