h,w=map(int,input().split()) u,d,r,l,k,p=map(int,input().split()) sx,sy,gx,gy=map(int,input().split()) c=[] for i in range(h): c.append(input()) dxdy=[(-1,0,u),(1,0,d),(0,1,r),(0,-1,l)] #ダイクストラ法 from heapq import heappush, heappop INF=10**18 def dijkstra(sx,sy,h,w): dist = [[INF]*w for i in range(h)] hq=[(0,sx-1,sy-1)] # (distance, node) dist[sx-1][sy-1]=0 seen=[[False]*w for i in range(h)] while hq: a,x,y=heappop(hq) # ノードを pop する # 変更箇所 if seen[x][y]: continue seen[x][y]=True for dx,dy,cost in dxdy: if 0<=x+dx<h and 0<=y+dy<w and seen[x+dx][y+dy]==False and c[x+dx][y+dy]!='#': if c[x+dx][y+dy]=='.' and dist[x][y]+cost<dist[x+dx][y+dy]: dist[x+dx][y+dy]=dist[x][y]+cost heappush(hq,(dist[x+dx][y+dy],x+dx,y+dy)) elif c[x+dx][y+dy]=='@' and dist[x][y]+cost+p<dist[x+dx][y+dy]: dist[x+dx][y+dy]=dist[x][y]+cost+p heappush(hq,(dist[x+dx][y+dy],x+dx,y+dy)) return dist t=dijkstra(sx,sy,h,w)[gx-1][gy-1] if t<=k: print('Yes') else: print('No')