#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; char C[110][110]; const ll INF=1LL<<60; struct Edge{ int to; ll w; Edge(int to,ll w) : to(to),w(w) {} }; using Graph=vector>; using pli=pair; template bool chmin(T& a,T b){ if(a>b){ a=b; return true; } return false; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int h,w; cin>>h>>w; ll u,d,r,l,k,P; cin>>u>>d>>r>>l>>k>>P; int xs,ys,xt,yt; cin>>xs>>ys>>xt>>yt; xs--,ys--,xt--,yt--; rep(i,h){ rep(j,w) cin>>C[i][j]; } Graph G(h*w); rep(i,h){ rep(j,w){ int p=i*w+j; int pu=p-w,pd=p+w,pr=p+1,pl=p-1; if(C[i][j]=='#') continue; else{ if(i>0 && C[i-1][j]=='.') G[p].push_back(Edge(pu,u)); else if(i>0 && C[i-1][j]=='@') G[p].push_back(Edge(pu,u+P)); if(i0 && C[i][j-1]=='.') G[p].push_back(Edge(pl,l)); else if(j>0 && C[i][j-1]=='@') G[p].push_back(Edge(pl,l+P)); } } } vector dist(h*w,INF); int s=xs*w+ys; dist[s]=0; priority_queue,greater> que; que.push({dist[s],s}); while(!que.empty()){ int v=que.top().second; ll d=que.top().first; que.pop(); if(d>dist[v]) continue; for(auto e:G[v]){ if(chmin(dist[e.to],dist[v]+e.w)){ que.push({dist[e.to],e.to}); } } } if(dist[xt*w+yt]<=k) cout<<"Yes"<