import sys from heapq import heappop, heappush input = sys.stdin.readline h, w = map(int, input().split()) def idxtoxy(idx): return idx // w, idx % w def xytoidx(x, y): return x * w + y n = h * w U, D, R, L, K, P = map(int, input().split()) sx, sy, gx, gy = map(int, input().split()) graph = [list(input()) for _ in range(h)] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] start = xytoidx(sx - 1, sy - 1) goal = xytoidx(gx - 1, gy - 1) cost = [D, R, U, L] def dijkstra(start, graph): infi = 1 << 80 mask = 1 << 18 pq = [] dist = [infi] * n heappush(pq, 0 * mask + start) while pq: temp = heappop(pq) d, v = temp // mask, temp & (mask - 1) if dist[v] <= d: continue if d > K: continue x, y = idxtoxy(v) dist[v] = d if v == goal: return dist[goal] for t in range(4): nx = x + dx[t] ny = y + dy[t] if 0 <= nx < h and 0 <= ny < w: delta = cost[t] if graph[nx][ny] == "#": continue if graph[nx][ny] == "@": delta += P u = xytoidx(nx, ny) nd = d + delta if dist[u] > nd: heappush(pq, nd * mask + u) return dist[goal] print("No" if dijkstra(start, graph) == 1 << 80 else "Yes")