#include using namespace std; #define REP(i,n) for (int i = 0; i < (n); ++i) template inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;} template inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;} using ll = long long; using P = pair; using Pl = pair; using veci = vector; using vecl = vector; using vecveci = vector>; using vecvecl = vector>; const int MOD = 1000000007; const double pi = acos(-1); ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);} ll lcm(ll a, ll b) {return a*b/gcd(a,b);} int dx[] = {-1,0,1,0}; int dy[] = {0,-1,0,1}; int main() { int H,W; cin >> H >> W; ll U,D,R,L,K,Px; cin >> U >> D >> R >> L >> K >> Px; int sx,sy,gx,gy; cin >> sy >> sx >> gy >> gx; sx--, sy--,gx--,gy--; vecl cost = {L,U,R,D}; vector S(H); REP(i,H) cin >> S[i]; vecvecl dist(H,vecl(W,1LL<<60)); priority_queue, vector>, greater>> que; que.push({0,{sy,sx}}); dist[sy][sx] = 0; while(que.size()) { pair p = que.top(); que.pop(); ll K = p.first; int i = p.second.first; int j = p.second.second; if(K > dist[i][j]) continue; REP(dir,4) { int ni = i + dy[dir]; int nj = j + dx[dir]; if(ni < 0 || ni >= H || nj < 0 || nj >= W) continue; if(S[ni][nj] == '#') continue; ll c = cost[dir]; if(S[ni][nj] == '@') c += Px; if(dist[ni][nj] > dist[i][j] + c) { dist[ni][nj] = dist[i][j] + c; que.push({dist[ni][nj],{ni,nj}}); } } } if(dist[gy][gx] > K) { cout <<"No" << endl; } else cout << "Yes" << endl; return 0; }