from heapq import heappop, heappush from math import inf DIJ = ((0, 1), (1, 0), (0, -1), (-1, 0)) def main(): H, W = map(int, input().split()) U, D, R, L, K, P = map(int, input().split()) move_costs = (R, D, L, U) xs, ys, xt, yt = map(lambda n: int(n) - 1, input().split()) board = [list(input()) for _ in range(H)] cost = [[inf for _ in range(W)] for _ in range(H)] cost[xs][ys] = 0 queue = [(0, (xs, ys))] while queue: c_d, c_pos = heappop(queue) if c_d > cost[c_pos[0]][c_pos[1]]: continue for dij, m_cost in zip(DIJ, move_costs): n_pos = (c_pos[0] + dij[0], c_pos[1] + dij[1]) if not (0 <= n_pos[0] < H and 0 <= n_pos[1] < W): continue if board[n_pos[0]][n_pos[1]] == "#": continue broken_cost = 0 if board[n_pos[0]][n_pos[1]] == "@": broken_cost = P if cost[n_pos[0]][n_pos[1]] > c_d + m_cost + broken_cost: cost[n_pos[0]][n_pos[1]] = c_d + m_cost + broken_cost heappush(queue, (cost[n_pos[0]][n_pos[1]], n_pos)) if cost[xt][yt] <= K: print("Yes") else: print("No") if __name__ == "__main__": main()