#include using namespace std; typedef pair Pa; int main(){ int H, W; cin >> H >> W; int U, D, R, L; cin >> U >> D >> R >> L; long long K, P; cin >> K >> P; int xs, ys, xt, yt; cin >> xs >> ys >> xt >> yt; xs--; xt--; ys--; yt--; vector S(H); for(int i = 0; i < H; i++) cin >> S[i]; long long INF = 1000000000000000000; vector cost(H * W, INF); priority_queue, greater> q; int dx[4] = {0, -1, 0, 1}, dy[4] = {1, 0, -1, 0}, T[4] = {D, L, U, R}; cost[xs * W + ys] = 0; q.push({cost[xs * W + ys], xs * W + ys}); while(!q.empty()){ auto [c, now] = q.top(); q.pop(); if(cost[now] < c) continue; int x = now / W, y = now % W; for(int i = 0; i < 4; i++){ int nx = x + dx[i], ny = y + dy[i]; if(0 <= nx && nx < H && 0 <= ny && ny < W){ if(S[nx][ny] == '.' && cost[nx * W + ny] > c + T[i]){ cost[nx * W + ny] = c + T[i]; q.push({cost[nx * W + ny], nx * W + ny}); } else if(S[nx][ny] == '@' && cost[nx * W + ny] > c + T[i] + P){ cost[nx * W + ny] = c + T[i] + P; q.push({cost[nx * W + ny], nx * W + ny}); } } } } if(cost[xt * W + yt] <= K) cout << "Yes" << endl; else cout << "No" << endl; }