from heapq import heapify, heappop, heappush def main(): H,W = map(int,input().split()) U,D,R,L,K,P = map(int,input().split()) xs,ys,xt,yt = map(int,input().split()) xs -= 1; ys -= 1; xt -= 1; yt -= 1 C = [str(input()) for _ in range(H)] INF = pow(10,20) #S:start, V: node, E: Edge, G: Graph d = [[INF]*W for _ in range(H)] d[xs][ys] = 0 PQ = [] heappush(PQ,(0,xs,ys)) dxdy = [(-1,0),(1,0),(0,1),(0,-1)] #U,D,R,L Pay = [U,D,R,L] while PQ: c,vx,vy = heappop(PQ) if d[vx][vy] < c: continue d[vx][vy] = c for i in range(4): ux = vx + dxdy[i][0] uy = vy + dxdy[i][1] if ux < 0 or ux >= H or uy < 0 or uy >= W: continue if C[ux][uy] == "#": continue #壁 cost = Pay[i] if C[ux][uy] == "@": #壊す cost += P if d[ux][uy] <= cost + d[vx][vy]: continue d[ux][uy] = cost + d[vx][vy] heappush(PQ,(d[ux][uy],ux,uy)) #print(d) if d[xt][yt] > K: print("No") else: print('Yes') if __name__ == '__main__': main()