from heapq import heappush, heappop inf = float('inf') def dijkstra(s, g, N): # ゴールがない場合はg=-1とする。 def cost(v, m): return v * N + m dist = [inf] * N mindist = [inf] * N seen = [False] * N Q = [cost(0, s)] while Q: c, m = divmod(heappop(Q), N) if seen[m]: continue seen[m] = True dist[m] = c if m == g: return dist #------heapをアップデートする。-------- for u, C in G[m]: if seen[u]: continue newdist = dist[m] + C #------------------------------------ if newdist >= mindist[u]: continue mindist[u] = newdist heappush(Q, cost(newdist, u)) return dist def f(h, w): return h * W + w H, W = map(int, input().split()) U, D, R, L, K, P = map(int, input().split()) cost = [D, R, U, L] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] sx, sy, gx, gy = map(int, input().split()) sx, sy, gx, gy = sx - 1, sy - 1, gx - 1, gy - 1 C = [] for i in range(H): C.append(list(input())) N = H * W G = [[] for i in range(N)] for h in range(H): for w in range(W): if C[h][w] == "#": continue for k in range(4): x = h + dx[k] y = w + dy[k] if x < 0 or x > H - 1 or y < 0 or y > W - 1: continue if C[x][y] == "#": continue c = cost[k] if C[x][y] == "@": c += P G[f(h,w)].append((f(x,y), c)) D = dijkstra(f(sx, sy), f(gx, gy), N) if D[f(gx, gy)] <= K: print("Yes") else: print("No")