#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1}; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int h,w; cin >> h >> w; vector mv(4); for(int i=0;i<4;i++){ cin >> mv[i]; } ll K,P; cin >> K >> P; int sx,sy,gx,gy; cin >> sx >> sy >> gx >> gy; sx--; sy--; gx--; gy--; vector s(h); for(int i=0;i> s[i]; } vector> dist(h,vector(w,1e18)); priority_queue>,vector>>,greater>>> pq; dist[sx][sy]=0; pq.push({0,{sx,sy}}); while(pq.size()){ auto p=pq.top(); pq.pop(); int x=p.second.first,y=p.second.second; if(dist[x][y]!=p.first)continue; for(int i=0;i<4;i++){ int nx=x+dx[i],ny=y+dy[i]; if(0<=nx and nxcost){ dist[nx][ny]=cost; pq.push({cost,{nx,ny}}); } } } } if(dist[gx][gy]<=K)printf("Yes\n"); else printf("No\n"); }