import heapq H,W = map(int,input().split()) U,D,R,L,K,P = map(int,input().split()) xs,ys,xt,yt = map(int,input().split()) C = ["#"+input().strip() for _ in range(H)] C = ["#"*(W+1)]+C INFTY = 10**14 dist = [[INFTY for _ in range(W+1)] for _ in range(H+1)] visited = [[False for _ in range(W+1)] for _ in range(H+1)] dist[xs][ys] = 0 heap = [(0,xs,ys)] while heap: d,i,j = heapq.heappop(heap) if dist[i][j]d+U: dist[i-1][j] = d+U heapq.heappush(heap,(d+U,i-1,j)) elif 1<=i-1<=H and C[i-1][j]=="@" and visited[i-1][j]==False: if dist[i-1][j]>d+U+P: dist[i-1][j] = d+U+P heapq.heappush(heap,(d+U+P,i-1,j)) if 1<=i+1<=H and C[i+1][j]=="." and visited[i+1][j]==False: if dist[i+1][j]>d+D: dist[i+1][j] = d+D heapq.heappush(heap,(d+D,i+1,j)) elif 1<=i+1<=H and C[i+1][j]=="@" and visited[i+1][j]==False: if dist[i+1][j]>d+D+P: dist[i+1][j] = d+D+P heapq.heappush(heap,(d+D+P,i+1,j)) if 1<=j-1<=W and C[i][j-1]=="." and visited[i][j-1]==False: if dist[i][j-1]>d+L: dist[i][j-1]=d+L heapq.heappush(heap,(d+L,i,j-1)) elif 1<=j-1<=W and C[i][j-1]=="@" and visited[i][j-1]==False: if dist[i][j-1]>d+L+P: dist[i][j-1]=d+L+P heapq.heappush(heap,(d+L+P,i,j-1)) if 1<=j+1<=W and C[i][j+1]=="." and visited[i][j+1]==False: if dist[i][j+1]>d+R: dist[i][j+1]=d+R heapq.heappush(heap,(d+R,i,j+1)) elif 1<=j+1<=W and C[i][j+1]=="@" and visited[i][j+1]==False: if dist[i][j+1]>d+R+P: dist[i][j+1]=d+R+P heapq.heappush(heap,(d+R+P,i,j+1)) if dist[xt][yt]<=K: print("Yes") else: print("No")