import sys INF = float('inf') #10**20,2**63,float('inf') MOD = 10**9 + 7 MOD2 = 998244353 #from collections import defaultdict def solve(): def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) H,W = MI() U,D,R,L,K,P =MI() Xs,Ys,Xt,Yt = MI() Map = [["#"]*(W+2) for _ in range(H+2)] for h in range(1,H+1): Tmp = LC() Map[h] = ["#"] + Tmp + ["#"] Graph = [[] for n in range((H+1)*(W+1) + 100)] Vec = [(0,1,R),(0,-1,L),(1,0,D),(-1,0,U)] for h in range(1,H+1): for w in range(1,W+1): if Map[h][w] == "#":continue A = H*(h-1) + (w-1) for di,dj,cost in Vec: dh = h+di dw = w+dj if Map[dh][dw] == "#":continue if Map[dh][dw] == "@":cost += P B = H*(dh-1) + dw-1 Graph[A].append((B,cost)) Start = H*(Xs-1) + Ys -1 Goal = H*(Xt-1) + Yt -1 from heapq import heappush, heappop def dijkstra(s, n): # (始点, ノード数) dist = [INF] * n hq = [(0, s)] # (distance, node) dist[s] = 0 seen = [False] * n # ノードが確定済みかどうか while hq: v = heappop(hq)[1] # ノードを pop する if seen[v]: continue seen[v] = True for to, cost in Graph[v]: # ノード v に隣接しているノードに対して if seen[to] == False and dist[v] + cost < dist[to]: dist[to] = dist[v] + cost heappush(hq, (dist[to], to)) return dist Dist = dijkstra(Start,(H+1)*(W+1) + 100) #print(Dist) #print(Dist[Goal]) if Dist[Goal] <= K: print("Yes") else: print("No") return solve() #sys.setrecursionlimit(10 ** 6)#再帰関数ではコメントにしないこと!!